<DA><RE>97975000-5</RE><RS>RUT DE
PRUEBA</RS><TD>33</TD><RNG><D>1</D><H>200</H></RNG><FA>2003-09-04</FA><RSAPK><M>0a4O6Kbx8Qj3K4iWSP4w7KneZYeJ+g/prihYtIEolKt3cykSxl1zO8vSXu397QhTmsX7SBEudTUx++2zDXBhZw==</M><E>Aw==</E></RSAPK><IDK>100</IDK></DA>
i try to compute the SHA-1 : sha = Digest::SHA1.hexdigest(input)
I obtain correct result => 9A2115CC03E05F99A996FBCE47C4554905D75D1D
After this first operation, i try to obtain the same result in Base64
(res=Base64.b64encode(sha)). If the operation was created with success,
i should obtain => miEVzAPgX5mplvvOR8RVSQXXXR0=
But, i find an other result and i don't understand what is the meaning
of that ?
i try to compute the SHA-1 : sha = Digest::SHA1.hexdigest(input)
I obtain correct result => 9A2115CC03E05F99A996FBCE47C4554905D75D1D
After this first operation, i try to obtain the same result in Base64
(res=Base64.b64encode(sha)). If the operation was created with success,
i should obtain => miEVzAPgX5mplvvOR8RVSQXXXR0=
But, i find an other result and i don't understand what is the meaning
of that ?
Since you didn't show what you *actually* get from your base64 encoding,
it's hard to be sure what you're doing wrong. But I guess you are base64
encoding the output of 'hexdigest' which is a hex string (40 ASCII
characters 0-9 and A-F) rather than the 20 bytes binary.
i have an other question. To find =>miEVzAPgX5mplvvOR8RVSQXXXR0=, i use
:
Base64.encode64(Digest::SHA1.digest('<DA><RE>97975000-5</RE><RS>RUT DE
PRUEBA</RS><TD>33</TD><RNG><D>1</D><H>200</H></RNG><FA>2003-09-04</FA><RSAPK><M>0a4O6Kbx8Qj3K4iWSP4w7KneZYeJ+g/prihYtIEolKt3cykSxl1zO8vSXu397QhTmsX7SBEudTUx++2zDXBhZw==</M><E>Aw==</E></RSAPK><IDK>100</IDK></DA>')).chomp