diff --git a/chacha.js b/src/chacha.js copy from chacha.js copy to src/chacha.js --- a/chacha.js +++ b/src/chacha.js @@ -10,7 +10,7 @@ function createNonce(){ return nonce; } -function Chacha20(key,nonce){ +export function Chacha20(key,nonce){ if(nonce===undefined){ let nonce=createNonce(); } @@ -70,13 +70,6 @@ Chacha20.prototype._incrementPos=functio this._state[12]=(this._state[12]+1)&MASK; }; -function encrypt(message,key){ - let nonce=Date.now(); - let nonce0=nonce; - let hashedKey=blake2s(str2bytes(key)); - message=str2bytes(message); -} - function testChacha(){ let key=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]; let nonce=[0,0,0,9,0,0,0,74,0,0,0,0];