Decrypt(text,ver)
   {
      if( text.substr(0,10) !== "CCT:CRYPTY")
      {
         console.log("Error: This file is not encrypted with Crypty");
         process.exit(-1);
      }
      ver = text.substr(10,3);
      text = text.substr(13);
      let iv = text.substr(0,32);
      text = text.substr(32);
      let hkey = HKey(this.key,iv);
      let n, count = RNDS[ver];

      for(n=0;n<count;n++)
      {
         let f = 'Decrypt'+ver;
         text = Decrypters[ver](text,hkey);
      }
      // final cleanup per version
      text = Finalize[ver](text);
      return text;
   }
// ver = version used to encrypt the string
ver = version used to encrypt the string
ver = version used to encrypt the string
Decrypt(text,ver)
   {
      if( text.substr(0,10) !== "CCT:CRYPTY")
      {
         console.log("Error: This file is not encrypted with Crypty");
         process.exit(-1);
      }
      ver = text.substr(10,3);
      text = text.substr(13);
      let iv = text.substr(0,32);
      text = text.substr(32);
      let hkey = HKey(this.key,iv);
      let n, count = RNDS[ver];
      for(n=0;n<count;n++)
      {
         let f = 'Decrypt'+ver;
         text = Decrypters[ver](text,hkey);
      }
      text = Finalize[ver](text);
      return text;
   }
Decrypt ( text , ver ) { if ( text . substr ( 0 , 10 ) !== "CCT:CRYPTY" ) { console . log ( "Error: This file is not encrypted with Crypty" ) ; process . exit ( - 1 ) ; } ver = text . substr ( 10 , 3 ) ; text = text . substr ( 13 ) ; let iv = text . substr ( 0 , 32 ) ; text = text . substr ( 32 ) ; let hkey = HKey ( this . key , iv ) ; let n , count = RNDS [ ver ] ; for ( n = 0 ; n < count ; n ++ ) { let f = 'Decrypt' + ver ; text = Decrypters [ ver ] ( text , hkey ) ; } text = Finalize [ ver ] ( text ) ; return text ; }
ver = version used to encrypt the string
ver = version used to encrypt the string
// final cleanup per version