forked from lampaa/javascript-anubis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
anubis_tests.html
40 lines (34 loc) · 1016 Bytes
/
anubis_tests.html
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
34
35
36
37
38
39
40
<meta charset="utf-8">
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/hmac-sha256.js"></script>
<script src='anubis.js'></script>
<script>
var anubis = new Anubis();
/*
* Use Base64, when encode non-Latin characters
*/
/**
* set key
*/
anubis.setKey('secret_key');
// anubis.setKey(key[, size])
// key - secret key
// size - fixed key size, between true or false
/**
* set text
*/
var enc = anubis.encrypt('Hellow world', false, false);
// anubis.encrypt(string[, hex[, base64]])
// string - the input string
// hex - output convert to HEX, between true or false
// base64 - encrypt a string to Base64, between true or false
/**
* decode text
*/
var dec = anubis.decrypt(enc, false, false);
// anubis.encrypt(string[, hex[, base64]])
// string - the input string
// hex - input deconvert from HEX, between true or false
// base64 - decrypt a string from Base64, between true or false
console.log("Encript: " + enc);
console.log("Decript: " + dec);
</script>