1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-28 04:19:56 +00:00
TiddlyWiki5/tw2/source/tiddlywiki/test/js/Crypto.js
Jeremy Ruston a1c8ac624f Added first pass at support for building TiddlyWiki 2.6.x with TW5
There are still some whitespace and attribute ordering issues, but the
result runs correctly.
2012-05-29 22:02:38 +01:00

28 lines
1.2 KiB
JavaScript
Executable File

jQuery(document).ready(function(){
module("Crypto");
test("SHA-1 functions", function() {
var actual = jQuery.encoding.digests.hexSha1Str("").toLowerCase();
var expected = "da39a3ee5e6b4b0d3255bfef95601890afd80709";
same(actual,expected,'SHA-1 hash of empty string should be correct');
actual = jQuery.encoding.digests.hexSha1Str("The quick brown fox jumps over the lazy dog").toLowerCase();
expected = "2fd4e1c67a2d28fced849ee1bb76e7391b93eb12";
same(actual,expected,'SHA-1 hash of test vector 1 should be correct');
actual = jQuery.encoding.digests.hexSha1Str("abc").toLowerCase();
expected = "a9993e364706816aba3e25717850c26c9cd0d89d";
same(actual,expected,'SHA-1 hash of test vector 2 should be correct');
actual = jQuery.encoding.digests.hexSha1Str("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq");
expected = "84983E441C3BD26EBAAE4AA1F95129E5E54670F1";
same(actual,expected,'SHA-1 hash of test vector 3 should be correct');
actual = jQuery.encoding.digests.hexSha1Str("12345678901234567890123456789012345678901234567890123456789012345678901234567890");
expected = "50ABF5706A150990A08B2C5EA40FA0E585554732";
same(actual,expected,'SHA-1 hash of test vector 4 should be correct');
});
});