2 -var lib = require('./build/Release/rijndael');
4 -var Rijndael = function(key, encoding) {
5 - if (!(this instanceof Rijndael))
6 - return new Rijndael(key);
8 - if (!Buffer.isBuffer(key))
9 - key = new Buffer(key, encoding);
14 -Rijndael.prototype.encrypt = function(plaintext) {
15 - if (!Buffer.isBuffer(plaintext))
16 - throw new TypeError('plaintext must be a buffer');
17 - return lib.rijndael(plaintext, this._key, true);
20 -Rijndael.prototype.decrypt = function(ciphertext) {
21 - if (!Buffer.isBuffer(ciphertext))
22 - throw new TypeError('ciphertext must be a buffer');
23 - return lib.rijndael(ciphertext, this._key, false);
26 -var createRijndael = function(key, encoding) {
27 - return new Rijndael(key, encoding);
30 -createRijndael.encrypt = function(plaintext, key) {
31 - return lib.rijndael(plaintext, key, true);
34 -createRijndael.decrypt = function(ciphertext, key) {
35 - return lib.rijndael(ciphertext, key, false);
38 -createRijndael.version = "0.0.2";
40 -module.exports = createRijndael;
41 +module.exports = require('./build/Release/rijndael');