From: "Iñaki Baz Castillo" Date: 2012-12-20T18:52:08+09:00 Subject: Re: Efficient way to encode a string with a secret string and recover it 2012/12/20 Iñaki Baz Castillo : > Hi, basically I receive a string generated by a user, then "encode" it > using some secret string I own and pass the result to other user, and > when I receive such a resulting string I must be able to decode it > using my secret string (but no other should be able to decode the > resulting string without knowing my secret key. This is: > > > original_string = "test" > > secret_key = "ABCD" > > modified_string = HASH_FUNCTION(original_string, secret_key) > > original_string = UNHASH_FUNCTION(modified_string, secret_key) > > > Any suggestion for the above HASH_FUNCTION and UNHASH_FUNCTION? I > would like it to be something really efficient. I've found the Crypt [*] library but it seems not adapted for Ruby 1.9. And I would prefer a C based Ruby extension. [*] http://crypt.rubyforge.org/ -- Iñaki Baz Castillo