1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-09 19:39:57 +00:00
TiddlyWiki5/test/tiddlywiki.2.6.5/source/tiddlywiki/deprecated/Crypto.js
Jeremy Ruston 07df513140 Revised test data
Testing against the output of cook.rb isn't satisfactory because of the
bugs in it; instead we're now going to test against the tiddlywiki.com
build products
2011-12-03 11:41:25 +00:00

45 lines
1020 B
JavaScript
Executable File

//--
//-- Deprecated Crypto functions and associated conversion routines.
//-- Use the jQuery.encoding functions directly instead.
//--
// Crypto 'namespace'
function Crypto() {}
// Convert a string to an array of big-endian 32-bit words
Crypto.strToBe32s = function(str)
{
return jQuery.encoding.strToBe32s(str);
};
// Convert an array of big-endian 32-bit words to a string
Crypto.be32sToStr = function(be)
{
return jQuery.encoding.be32sToStr(be);
};
// Convert an array of big-endian 32-bit words to a hex string
Crypto.be32sToHex = function(be)
{
return jQuery.encoding.be32sToHex(be);
};
// Return, in hex, the SHA-1 hash of a string
Crypto.hexSha1Str = function(str)
{
return jQuery.encoding.digests.hexSha1Str(str);
};
// Return the SHA-1 hash of a string
Crypto.sha1Str = function(str)
{
return jQuery.encoding.digests.sha1Str(str);
};
// Calculate the SHA-1 hash of an array of blen bytes of big-endian 32-bit words
Crypto.sha1 = function(x,blen)
{
return jQuery.encoding.digests.sha1(x,blen);
};