diff options
Diffstat (limited to 'TestEncryption.php')
-rw-r--r-- | TestEncryption.php | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/TestEncryption.php b/TestEncryption.php index e4a9085..097b727 100644 --- a/TestEncryption.php +++ b/TestEncryption.php @@ -14,18 +14,26 @@ <script src="assets/js/encryption.js"></script>
<script>
// The passphrase used to repeatably generate this RSA key.
- var PassPhrase = "The Moon is a Harsh Mistress.";
-
+ var PassPhrase = randomString(16);
// The length of the RSA key, in bits.
var Bits = 1024;
-
var MattsRSAkey = cryptico.generateRSAKey(PassPhrase, Bits);
var MattsPublicKeyString = cryptico.publicKeyString(MattsRSAkey);
- var PlainText = "Matt, I need you to help me with my Starcraft strategy.";
+ var PlainText = "Hello Bro";
var EncryptionResult = cryptico.encrypt(PlainText, MattsPublicKeyString);
-
console.log(EncryptionResult.cipher);
+
+ function randomString(len, charSet) {
+ charSet = charSet || 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
+ var randomString = '';
+ for (var i = 0; i < len; i++) {
+ var randomPoz = Math.floor(Math.random() * charSet.length);
+ randomString += charSet.substring(randomPoz,randomPoz+1);
+ }
+ return randomString;
+ }
+
</script>
</body>
</html>
\ No newline at end of file |