You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
607 B
21 lines
607 B
var should = require('chai').should();
|
|
var CBC = require('../lib/expmt/cbc');
|
|
|
|
describe('CBC', function() {
|
|
|
|
describe('@pkcs7pad', function() {
|
|
|
|
it('should pad this 32 bit buffer to 128 bits with the number 128/8 - 32/8', function() {
|
|
var buf = new Buffer(32 / 8);
|
|
buf.fill(0);
|
|
var padbuf = CBC.pkcs7pad(buf, 128);
|
|
padbuf.length.should.equal(128 / 8);
|
|
padbuf[32 / 8].should.equal(128 / 8 - 32 / 8);
|
|
padbuf[32 / 8 + 1].should.equal(128 / 8 - 32 / 8);
|
|
// ...
|
|
padbuf[32 / 8 + 128 / 8 - 32 / 8 - 1].should.equal(128 / 8 - 32 / 8);
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|