UNPKG

twofish

Version:

Javascript Twofish implementation.

19 lines (15 loc) 808 B
/*global describe it expect twofish*/ (function doTest(describe, it, expect, twofish){ 'use strict'; describe('CBC issue #1', function doTestSuite() { var IV = [0xb4, 0x6a, 0x02, 0x60, 0xb0, 0xbc, 0x49, 0x22, 0xb5, 0xeb, 0x07, 0x85, 0xa4, 0xb7, 0xcc, 0x9e] , twF = twofish(IV); it('cbc - issue use case', function doTestCase() { var ct = [0x14, 0x25, 0xe4, 0xbb, 0x3d, 0x59, 0xf5, 0x57, 0x34, 0xaf, 0x26, 0x3a, 0x60, 0x09, 0x79, 0x01] , key = [0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00] , pt = [0x5e, 0xa0, 0x80, 0x00, 0x00, 0x01, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe8, 0x1c, 0x00] , cpt = twF.decryptCBC(key, ct); expect(pt).toEqual(cpt); }); }); }(describe, it, expect, twofish));