Can anyone show me how this is done in PB? I'm trying to convert RC4 encryption from another language to PureBasic.The mod operator returns the remainder obtained by dividing its operands. In other words, x mod y = x - (x div y) * y.
What is 'mod' in PB?
-
- Enthusiast
- Posts: 125
- Joined: Sat Jun 17, 2006 3:15 pm
What is 'mod' in PB?
Mod is used in another language, as said in its manual:
-
- Enthusiast
- Posts: 125
- Joined: Sat Jun 17, 2006 3:15 pm
Awesome, Thanks, One last question, i have no clues for this, But what is '^' in PureBasic?
For example
For example
Code: Select all
Chr(Asc(Mid(Str$,i+1,i+2)) ^ k)
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
-
- Enthusiast
- Posts: 125
- Joined: Sat Jun 17, 2006 3:15 pm
Lol, awesome.. Slow-pokes. Thanks for the help, this may be going off topic now, HOPEFULLY the last question, But whats wrong with:
The error is:
Array Index out of bounds.
What would be the reason causing this?
Code: Select all
BoxRC4(i) = BoxRC4(j)
Array Index out of bounds.
What would be the reason causing this?
assuming that "BoxRC4" is a Array either "i" or "j" are outside the specified Range
Ex:
check your loops
Ex:
Code: Select all
Dim BoxRC4(10)
BoxRC4(10) = BoxRC4(11) ;<- 11 is error 10 is ok
Last edited by Dreglor on Sun Jul 30, 2006 2:17 am, edited 2 times in total.
~Dreglor
Either i or j has a value outside of the array dimensions.
Eg:
Do a Debug i and a Debug j just before the assignment to see what the values are.
Edit: * joins the slowpokes in the peanut gallery *
Eg:
Code: Select all
Dim Arr(10)
Arr(99) = Arr(2763)
Edit: * joins the slowpokes in the peanut gallery *
Dare2 cut down to size
-
- Enthusiast
- Posts: 125
- Joined: Sat Jun 17, 2006 3:15 pm
Re: What is 'mod' in PB?
Why reinvent the wheel???? Do a search: http://www.purebasic.fr/english/viewtopic.php?t=6905..::Origin::.. wrote:I'm trying to convert RC4 encryption from another language to PureBasic.