Posted by robost86 on 07:10:00 04-26-2002
: pow 1 swap 0 do over * loop swap drop ; : group dup 1 do over i pow over mod . loop drop drop ;
So, what does this do? It defines the word
group ( g m -- )
It prints out all numbers g^x (mod m), where 1 <= x < m
Kind of interesting, isn't it? If you've found a generator of F[m]*, then this will print out all numbers from 1 to m-1, but in a "random" order. Hint: choose g and m as primes, where g < m
g = 3 and m = 7 will give you a nice example.
If you choose larger values, you risk overflowing your forth, so that it will output nonsense
Reversing the function g^x (mod m) is very hard, this is a so called one-way function, often used within cryptography. This is called the discrete log proglem.
Tip: there's a forth bot called sif on irc.openprojects.net, open a query to sif (if it's online), and type:
: pow 1 swap 0 do over * loop swap drop ; : group dup 1 do over i pow over mod . loop drop drop ; 3 7 group
(Where the 3 7 in the end are the g and m values).
Posted by sacah on 18:20:00 04-26-2002
You need a social life.
Posted by MoX on 20:11:00 04-26-2002
Can't help thinking the same. Let's vote for rob_ert as geekiest nerd of the year.
[addsig]
Posted by sacah on 20:34:00 04-26-2002
You got my vote
C-:
Posted by robost86 on 20:37:00 04-26-2002
I feel honored.
Posted by nonama on 23:16:00 05-11-2002
forth poem.
Posted by Flikm on 11:17:00 05-13-2002
oknpunfasdjl aohasfnauontr aosdfnasod;asf *asd *dfkih;
theres some more forth code.
Posted by fsvara on 01:20:00 05-14-2002
apropos mad sourcecode and stuff... did you see that quadrilingual program? sourcecode that compiles and does the same in befunge, perl, C and brainfuck...
http://www.if.insa-lyon.fr/eleves/jquelin/quadri.html
Posted by neonbjb on 08:54:00 01-09-2003
wtfit???? you got my vote too!