 |
Forums |
Admin Discussion Forums: help Start New Thread
By: Daniel Berger
RE: extra character on result [ reply ] 2009-07-22 15:44
|
Hi Eric,
I think you're seeing the extra " characters because of the way String#inspect works, not because they're part of the actual string. Change your "p" to "puts" and see what you see.
Regards,
Dan
|
By: Eric Peterson
extra character on result [ reply ] 2009-06-17 22:40
|
I was looking for a simple encryption routine for a web app for my local group. I came across yours and while it seems to fit, I find an issue. If I don't do this - s.to_s[1..s.size] - I get leading \" characters. Is this the way to get a string of just my encrypted value? Or is there a better way?
Thanks
Eric
With out - s.to_s[1..s.size]
C:\A\ruby>cpt
"e: \"hgs\""
"ue: edp"
"ue: edp"
With - s.to_s[1..s.size]
C:\A\ruby>cpt
"e: hgs"
"ue: edp"
"ue: edp"
C:\A\ruby>more cpt.rb
require "crypt/fog"
include Crypt
degree = 3
pd = 'edp'
s = Fog.new( pd, degree )
p 'e: ' + s.to_s[1..s.size]
p 'ue: ' + Fog.decrypt( s, degree ).to_s
p 'ue: ' + Fog.decrypt( 'hgs', degree ).to_s
|
|
 |