|
|
@ -2,6 +2,16 @@ var should = require('chai').should(); |
|
|
|
var CBC = require('../lib/expmt/cbc'); |
|
|
|
|
|
|
|
describe('CBC', function() { |
|
|
|
|
|
|
|
it('should return a new CBC', function() { |
|
|
|
var cbc = new CBC(); |
|
|
|
should.exist(cbc); |
|
|
|
}) |
|
|
|
|
|
|
|
it('should return a new CBC when called without "new"', function() { |
|
|
|
var cbc = new CBC(); |
|
|
|
should.exist(cbc); |
|
|
|
}); |
|
|
|
|
|
|
|
describe('@pkcs7pad', function() { |
|
|
|
|
|
|
@ -18,4 +28,22 @@ describe('CBC', function() { |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
describe('@xorbufs', function() { |
|
|
|
|
|
|
|
it('should xor 1 and 0', function() { |
|
|
|
var buf1 = new Buffer([1]); |
|
|
|
var buf2 = new Buffer([0]); |
|
|
|
var buf = CBC.xorbufs(buf1, buf2); |
|
|
|
buf[0].should.equal(1); |
|
|
|
}); |
|
|
|
|
|
|
|
it('should xor 1 and 1', function() { |
|
|
|
var buf1 = new Buffer([1]); |
|
|
|
var buf2 = new Buffer([1]); |
|
|
|
var buf = CBC.xorbufs(buf1, buf2); |
|
|
|
buf[0].should.equal(0); |
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|