[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: openSSL signs

Andrew Stewart

12/1/2006 9:10:00 AM


On 30 Nov 2006, at 18:36, Jose francisco Gonzalez carmona wrote:

> data = 'abcdefghijklmnsopqrstuvwxyz\n'
>
[snip]
>
> but changing the data variable from sigle quoted to double quoted:
>
> data = "abcdefghijklmnsopqrstuvwxyz\n"
>
> the answer is:
>
> verified: false
>
> i know that escaped characters are treated diferently within double
> quoted strings, but i sign and verify the same data in both cases.
> ¿what's happen?

It's not quite the same data in both cases. The \n is treated
differently as you mentioned and this difference makes the whole
string different.

In IRB:

>> puts 'abc\n'
abc\n
=> nil

>> puts "abc\n"
abc
=> nil

>> 'abc\n'.length
=> 5

>> "abc\n".length
=> 4

Regards,
Andy Stewart