I tried to implement a simple RSA crypto for my work. It seems all works
fine, except that I am not satisfied with the code I wrote below:
h = ‘0x’
(0…s.length).each do |i|
h += “%02x” % s[i]
s = ‘’
while n > 0 do
s = “%c” % (n & 0xFF) + s
n = n >> 8
These 2 functions convert string to bignum and vise-versa. It works, but
feel there should be better (faster) way to do this.
Could anyone point the way out?