JavaScript Encryption Library

jscrypto

jscrypto library is an object oriented cryptography library that implements algorithms including AES, SHA-1, HMAC, BASE64, RSA, ECC and IBE for JavaScript. It works in ActionScript as well.

Features

* Performance heavily enhanced.
* Object oriented architecture.
* Support Init, Upate, Final pattern for bulk data processing for most algorithms.
* Parllellized computing, even long term operation will not block the browser.
* Support key storage interface, with multiple implementations.


Packer JavaScript in PHP


<?php  require_once 'class.JavaScriptPacker.php'?>



<script type="text/javascript">

<?php

$script='';

$script.=' $f("a.rtmp", "flowplayer-3.2.7.swf", { 

clip: { 

    provider: "rtmp"

}, 

plugins: { ';

$script.='controls: null,';

$script.='    rtmp: {  

    url: "flowplayer.rtmp-3.2.3.swf",            

    netConnectionUrl: "'.$streamer.'"  

},

secure: { 

    token: escape("'.$canned_policy_stream_name.'")

}

}    });';

$packer = new JavaScriptPacker($script10truefalse);

$packed $packer->pack();

echo 
$packed;

?>

</script>


AES (Advanced Encryption Standard)

AES is a ‘symmetric block cipher’ for encrypting texts which can be decrypted with the original encryption key.


AES Encryption in PHP :

<?php

require 'aes.class.php';     // AES PHP implementation

require 'aesctr.class.php';  // AES Counter Mode implementation 

 

$obj = new AesCtr;

$encText $obj->encrypt($plaintext$password$nBits);

?>


AES decryption in PHP :

<?php

require 'aes.class.php';     // AES PHP implementation

require 'aesctr.class.php';  // AES Counter Mode implementation 

 

$obj = new AesCtr;

$decText $obj->encrypt($ciphertext$password$nBits);

?>




AES Encryption in JavaScript :

<script type="text/javascript">

    Var encText = Aes.Ctr.encrypt(plaintext, password , nBits);

</script>


AES Decryption in JavaScript :

<script type="text/javascript">

    var decText = Aes.Ctr.decrypt(ciphertext, password , nBits);

</script>