Pot.Arc4.prototype.setKey

{Pot.Arc4} Pot.Arc4.prototype.setKey ({String} key)

Pot.js で利用可能。 PotLite.js では利用できません。

Arc4 の鍵を設定します。

暗号化/復号化に使用する鍵を設定します。
引数 key に文字列で渡します。

現在の Pot.Arc4 インスタンス が返ります。

var arc4 = new Pot.Arc4();

// 鍵を設定
arc4.setKey('hoge');

// 暗号化
var cipherText = arc4.encrypt('Hello World!');
debug('cipherText = ' + cipherText); // 'cipherText = (...cipherText)'

// 復号化
var origText = arc4.decrypt(cipherText);
debug('origText = ' + origText); // 'origText = Hello World!'