diff options
Diffstat (limited to 'contexts/data/lib/closure-library/closure/goog/demos/blobhasher.html')
-rw-r--r-- | contexts/data/lib/closure-library/closure/goog/demos/blobhasher.html | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/contexts/data/lib/closure-library/closure/goog/demos/blobhasher.html b/contexts/data/lib/closure-library/closure/goog/demos/blobhasher.html deleted file mode 100644 index 2403f82..0000000 --- a/contexts/data/lib/closure-library/closure/goog/demos/blobhasher.html +++ /dev/null @@ -1,61 +0,0 @@ -<!DOCTYPE html> -<html> -<!-- -Copyright 2011 The Closure Library Authors. All Rights Reserved. - -Use of this source code is governed by the Apache License, Version 2.0. -See the COPYING file for details. - ---> -<head> -<title>goog.crypt.BlobHasher</title> -<script src="../base.js"></script> -<script> - goog.require('goog.crypt'); - goog.require('goog.crypt.BlobHasher'); - goog.require('goog.crypt.Md5'); -</script> -<link rel="stylesheet" href="css/demo.css"> -</head> -<body> -<h1>goog.crypt.BlobHasher</h1> -<table> -<tr><td>File:</td><td> - <input type="file" onchange="computeMD5(this.files[0]);"> - <input type="button" value="Abort" onclick="abort();"> -</td></tr> -<tr><td>MD5:</td><td><div id="output" style="font-family:courier new,fixed" /></td></tr> -</table> -<script> - -var hashFn = new goog.crypt.Md5(); -var blobHasher = new goog.crypt.BlobHasher(hashFn); -var startTime = 0; - -function computeMD5(file) { - goog.events.listen(blobHasher, goog.crypt.BlobHasher.EventType.COMPLETE, - function() { - var hash = goog.crypt.byteArrayToHex(blobHasher.getHash()); - var time = goog.now() - startTime; - display(hash + ' (' + time/1000 + 's)'); - }); - goog.events.listen(blobHasher, goog.crypt.BlobHasher.EventType.ABORT, - function() { - display('Aborted'); - }); - display('Computing...'); - startTime = goog.now(); - blobHasher.hash(file); -} - -function abort() { - blobHasher.abort(); -} - -function display(message) { - document.getElementById('output').innerHTML = message; -} - -</script> -</body> -</html> |