Hash.js, minor formatting changes
This commit is contained in:
parent
44ec0d1ecb
commit
def7c88639
1 changed files with 22 additions and 19 deletions
|
@ -1,10 +1,11 @@
|
|||
'use strict';
|
||||
|
||||
/*@
|
||||
Ox.oshash <f> compute oshahs for given File or Blob object (async)
|
||||
Ox.oshash <f> Calculates oshash for a given file or blob object. Async.
|
||||
@*/
|
||||
Ox.oshash = function(file, callback) {
|
||||
//needs to go via string to work for files > 2GB
|
||||
|
||||
// Needs to go via string to work for files > 2GB
|
||||
var hash = fromString(file.size.toString());
|
||||
|
||||
read(0);
|
||||
|
@ -18,7 +19,7 @@ Ox.oshash = function(file, callback) {
|
|||
c &= 0xffff;
|
||||
a = A[0] + B[0] + (b >> 16);
|
||||
b &= 0xffff;
|
||||
//cut of overflow
|
||||
// Cut off overflow
|
||||
a &= 0xffff;
|
||||
return [a, b, c ,d];
|
||||
}
|
||||
|
@ -58,10 +59,12 @@ Ox.oshash = function(file, callback) {
|
|||
}
|
||||
|
||||
function hex(h) {
|
||||
return (Ox.pad(h[0].toString(16), 4)
|
||||
return (
|
||||
Ox.pad(h[0].toString(16), 4)
|
||||
+ Ox.pad(h[1].toString(16), 4)
|
||||
+ Ox.pad(h[2].toString(16), 4)
|
||||
+ Ox.pad(h[3].toString(16), 4)).toLowerCase();
|
||||
+ Ox.pad(h[3].toString(16), 4)
|
||||
).toLowerCase();
|
||||
}
|
||||
|
||||
function read(offset, last) {
|
||||
|
|
Loading…
Reference in a new issue