interop.html 926 Bytes
Newer Older
Daniel Hofmann's avatar
Daniel Hofmann committed
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
32
33
<!DOCTYPE html>
<html lang="de">
    <head>
        <meta charset="utf-8">
        <title>AES (in CBC mode) language interop tester</title>

        <!-- notes:
              - host locally!
        --!>
        <script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/aes.js"></script>
    </head>
    <body>
        <p>check console for now!</p>
    </body>
    <script>
        "use strict";

        var plaintext = 'Hello';
        var key = '0000000000000000';
        var iv = '0000000000000000';

        var opts = { iv: iv,
                     keySize: 128 / 8,
                     mode: CryptoJS.mode.CBC,
                     padding: CryptoJS.pad.Pkcs7 };

        var enc = CryptoJS.AES.encrypt(plaintext, key, opts);

        console.log({key: key, iv: iv, plaintext: plaintext});
        console.log(enc.toString())
    </script>
</html>
<!-- vim: set tabstop=4 shiftwidth=4 expandtab: --!>