Sign In/My Account | View Cart  
advertisement

Article:
 Atom Authentication
Subject: Base64 encoding of SHA1 digest
Date: 2003-12-18 07:01:13
From: Piotr Lakomy

The base64 encoding of the SHA1(Password + CreationTimestamp + Nonce) should be "quR/EWLAV4xLf9Zqyw4pDmfV9OY".


Looks like example in the article applies base64 to to the hex encoding of SHA1 value:
base64("aae47f1162c0578c4b7fd66acb0e290e67d5f4e6") = "YWFlNDdmMTE2MmMwNTc4YzRiN2ZkNjZhY2IwZTI5MGU2N2Q1ZjRlNg=="
(Note two filler "=" charactes at the end).


Here is perl code to verify:


use Digest::SHA1 qw(sha1 sha1_hex sha1_base64);;
use MIME::Base64 qw(encode_base64);


$password = "taadtaadpstcsm";
$nonce = "d36e316282959a9ed4c89851497a717f";
$timestamp = "2003-12-15T14:43:07Z";
$text = $nonce . $timestamp . $password;


print "text = $text\n";
print "SHA1 hex = " . sha1_hex($text) . "\n";
print "SHA1 b64 = " . sha1_base64($text) . "\n";
print "SHA1 b64(hex) = " . encode_base64(sha1_hex($text));


Very good article, I like it.




No Previous Message Previous Message   Next Message Next Message


Full Text Titles Only Newest First

Sponsored By: