Lines Matching defs:key

207   key =  hexToByteArray(hs);
208 hs = byteArrayToHex(key);
209 return(key);
227 var elem=null, atab=null, key="", ptext="";
235 // encrypt text (set back to ctext, and forget key)
242 alert("unable to find key for lock " + lock);
271 x=prompt("Enter passphrase key for lock " + lock);
273 y=prompt("Verify passphrase key for lock " + lock);
291 var ret="", key="", ctext="";
312 var ret="", key="", ctext="";
335 function verifyDecrypt(ctext,lock,key) {
337 if(undefined!==crypt_keys[lock]) { key=crypt_keys[lock]; }
338 if(key===false && (undefined===crypt_keys[lock])) {
339 var key=prompt("Enter passphrase for lock " + lock);
340 if(key===null) { return(false); } // user hit cancel
341 if(!(ptext=decryptTextString(ctext,key))) {
343 while(null!==(key=prompt(pstr))) {
344 ptext=decryptTextString(ctext,key);
349 if(key==null) { return(false); } // user hit cancel
351 crypt_keys[lock]=key;
353 var xkey=key;
354 if(key===false) { xkey=crypt_keys[lock]; }
356 if(key!==false) { alert("failed to decrypt with provided key"); }
362 function decryptBlock(data,key) {
378 if(!(ptext=verifyDecrypt(data.substring(tagend+1,ptend),lock,key))) {
398 function encryptBlock(data,key) {
416 if(key===false) {
417 key=getEncryptionKeyForLock(lock);
418 if(key===false) { return(false); }
420 if(!(ctext=encryptTextString(data.substring(tagend+1,ptend),key))) {
428 /* encrypt the string in text with ascii key in akey
429 modified from Encrypt_Text to expect ascii key and take input params
433 var v, i, ret, key;
439 alert("Please specify a key with which to encrypt the message.");
447 key=setKeyFromAscii(akey);
488 var ct = rijndaelEncrypt(header + plaintext, key, "CBC");
494 key=setKeyFromAscii(akey);
499 var result=rijndaelDecrypt(ct,key,"CBC");
523 crypt_debug("Invalid decryption key.");
691 // Adds the current round key to the state information. Straightforward.
702 // This function creates the expanded key from the input (128/192/256-bit)
703 // key. The parameter key is an array of bytes holding the value of the key.
705 // make up the expanded key.
707 function keyExpansion(key) {
711 // in case the key size or parameters were changed...
716 for (var j=0; j < Nk; j++) { // Fill in input key first
718 (key[4*j]) | (key[4*j+1]<<8) | (key[4*j+2]<<16) | (key[4*j+3]<<24);
721 // Now walk down the rest of the array filling in expanded key bytes as
723 for (j = Nk; j < Nb * (Nr + 1); j++) { // For each word of expanded key
771 // an array of words representing the expanded key previously returned by
788 // an array of words representing the expanded key previously returned by
933 // rijndaelEncrypt(plaintext, key, mode)
934 // Encrypts the plaintext using the given key and in the given mode.
936 // The parameter "key" must be an array of key bytes. If you have a hex
937 // string representing the key, invoke hexToByteArray() on it to convert it
945 function rijndaelEncrypt(plaintext, key, mode) {
950 if (!plaintext || !key) { return; }
951 if (key.length*8 != keySizeInBits) { return; }
963 expandedKey = keyExpansion(key);
978 // rijndaelDecrypt(ciphertext, key, mode)
979 // Decrypts the using the given key and mode. The parameter "ciphertext"
980 // must be an array of bytes. The parameter "key" must be an array of key
981 // bytes. If you have a hex string representing the ciphertext or key,
989 function rijndaelDecrypt(ciphertext, key, mode) {
996 if (!ciphertext || !key || typeof ciphertext == "string") { return; }
997 if (key.length*8 != keySizeInBits) { return; }
1000 expandedKey = keyExpansion(key);
1044 /* Capture entropy. When the user presses a key or performs
1138 /* Compute a 32 byte key value from the entropy vector.
1180 this.key = [];
1181 this.key = seed;
1190 /* Encrypt the initial text with the seed key
1192 back into the key for the next round. */
1198 this.key = rijndaelEncrypt(this.itext, this.key, "ECB");
1202 key-feedback rounds, with the number determined
1206 var n = 1 + (this.key[3] & 2) + (this.key[9] & 1);
1208 this.key = rijndaelEncrypt(this.itext, this.key, "ECB");
1216 this.key = rijndaelEncrypt(this.itext, this.key, "ECB");
1226 return(this.key[--this.nbytes]);