Title: [219693] trunk/Websites/webkit.org
Revision
219693
Author
[email protected]
Date
2017-07-20 10:18:56 -0700 (Thu, 20 Jul 2017)

Log Message

Unreviewed, add the final demo page for a WebCrypto API blog post

* demos/webcrypto/pbkdf2.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/Websites/webkit.org/ChangeLog (219692 => 219693)


--- trunk/Websites/webkit.org/ChangeLog	2017-07-20 17:00:56 UTC (rev 219692)
+++ trunk/Websites/webkit.org/ChangeLog	2017-07-20 17:18:56 UTC (rev 219693)
@@ -1,5 +1,11 @@
 2017-07-20  Jiewen Tan  <[email protected]>
 
+        Unreviewed, add the final demo page for a WebCrypto API blog post
+
+        * demos/webcrypto/pbkdf2.html: Added.
+
+2017-07-20  Jiewen Tan  <[email protected]>
+
         Unreviewed, add yet another demo page for a WebCrypto API blog post
 
         * demos/webcrypto/aes-gcm.html:

Added: trunk/Websites/webkit.org/demos/webcrypto/pbkdf2.html (0 => 219693)


--- trunk/Websites/webkit.org/demos/webcrypto/pbkdf2.html	                        (rev 0)
+++ trunk/Websites/webkit.org/demos/webcrypto/pbkdf2.html	2017-07-20 17:18:56 UTC (rev 219693)
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>WebCrypto API Demo: PBKDF2</title>
+    <style>
+    .inner
+    {
+        display: inline-block;
+    }
+    </style>
+    <script type="text/_javascript_" src=""
+    <script type="text/_javascript_">
+    function PBKDF2()
+    {
+        var rawKey = document.getElementById("password").value;
+
+        crypto.subtle.importKey("raw", asciiToUint8Array(rawKey), "PBKDF2", false, ["deriveBits"]).then(function(baseKey) {
+            return crypto.subtle.deriveBits({name: "PBKDF2", salt: crypto.getRandomValues(new Uint8Array(16)), iterations: 100000, hash: "sha-256"}, baseKey, 128);
+        }, failAndLog).then(function(result) {
+            document.getElementById("derivedKey").innerHTML = bytesToHexString(result);
+        }, failAndLog);
+    }
+    </script>
+</head>
+<body>
+    <h1>PBKDF2</h1>
+    <p>Click the following button multiple times to see how random salts can strengthen password hashes.</p>
+    <div>
+        Password: <input type="text" id="password" value="123456789">
+        <button type="button" _onclick_="PBKDF2()" class="inner">derive</button>
+        <div id="derivedKey" class="inner"></div>
+    </div>
+</body>
+</html>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to