Revision 46:f16f6e0e5b69 src/pithos/content/lib/sha.js
b/src/pithos/content/lib/sha.js | ||
---|---|---|
1 |
b64pad = "="; |
|
2 |
|
|
3 |
/* |
|
4 |
* Signs a raw data string (d) with a uunencoded key (k) as per |
|
5 |
* GSS requirements. |
|
6 |
*/ |
|
7 |
function gss_sign(k, d) |
|
8 |
{ |
|
9 |
var res= rstr_hmac_sha1(atob(k),d); |
|
10 |
|
|
11 |
return(btoa(res)); |
|
12 |
} |
|
13 |
|
|
14 |
|
|
15 | 1 |
/* |
16 | 2 |
* A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined |
17 | 3 |
* in FIPS 180-1 |
... | ... | |
22 | 8 |
*/ |
23 | 9 |
|
24 | 10 |
/* |
11 |
* NOTICE: For the pithos file manager, the original authors have added function gss_sign, |
|
12 |
* defined at the end of the file. |
|
13 |
*/ |
|
14 |
|
|
15 |
/* |
|
25 | 16 |
* Configurable variables. You may need to tweak these to be compatible with |
26 | 17 |
* the server-side, but the defaults work in most cases. |
27 | 18 |
*/ |
... | ... | |
342 | 333 |
{ |
343 | 334 |
return (num << cnt) | (num >>> (32 - cnt)); |
344 | 335 |
} |
336 |
|
|
337 |
|
|
338 |
/* |
|
339 |
* Signs a raw data string (d) with a uunencoded key (k) as per |
|
340 |
* GSS requirements. |
|
341 |
*/ |
|
342 |
function gss_sign(k, d) |
|
343 |
{ |
|
344 |
var res= rstr_hmac_sha1(atob(k),d); |
|
345 |
|
|
346 |
return(btoa(res)); |
|
347 |
} |
|
348 |
|
Also available in: Unified diff