This is the mail archive of the guile@cygnus.com mailing list for the guile project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Oh, an example: 79 and 3337 are the public key, and 1019 and 3337 are the private key. $ cat rsa #!/usr/local/bin/guile -s !# (define(x b e n)(let((l modulo))(if(= e 1)(l b n)(if(= e 0)1(let((h(x b (quotient e 2)n)))(if(even? e)(l(* h h)n)(l(* h h b)n)))))))(apply(lambda(e n) (let l()(let((b(read)))(if(not(eof-object? b))(begin(write(x b e n))(newline) (l))))))(map string->number(cdr(command-line)))) $ echo 617 492 349 | rsa 79 3337 1428 937 257 $ echo 1428 937 257 | rsa 1019 3337 617 492 349 $ Your input numbers must be less than your modulus.