-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsha1.min.js
1 lines (1 loc) · 2.38 KB
/
sha1.min.js
1
!function(r,n){"use strict";function e(r){for(var n=0,e=0,o=0;o<r.length;++o)e=r.charCodeAt(o),n+=e>=55296&&e<=56319?++o>=r.length?0:4:e<=127?1:e<=2047?2:3;for(var t=new Array(n),o=0,a=0;o<r.length;++o){if(e=r.charCodeAt(o),e>=56320&&e<=57343)throw new Error("Encounter an unpaired surrogate. [char="+e+"]");if(e>=55296&&e<=56319){if(++o>=r.length)throw new Error("Encounter an unpaired surrogate. [char="+e+"]");var f=r.charCodeAt(o);if(f<56320||f>57343)throw new Error("Encounter an unpaired surrogate. [char="+e+", tail="+f+"]");e=((1023&e)<<10|1023&f)+65536}e<=127?t[a++]=e:e<=2047?(t[a++]=(e>>>6)+192,t[a++]=(63&e)+128):e<=65535?(t[a++]=(e>>>12)+224,t[a++]=(e>>>6&63)+128,t[a++]=(63&e)+128):(t[a++]=(e>>>18)+240,t[a++]=(e>>>12&63)+128,t[a++]=(e>>>6&63)+128,t[a++]=(63&e)+128)}return t}function o(r){var n=[1732584193,4023233417,2562383102,271733878,3285377520],o=[0,0],f=e(r),h=f.length%64;t(o,f.length),a(f,n);for(var d=0;d<i.length;++d)i[d]=d<h?f[f.length-h+d]:d==h?128:0;h<56?(i[56]=o[0]>>>24&255,i[57]=o[0]>>>16&255,i[58]=o[0]>>>8&255,i[59]=255&o[0],i[60]=o[1]>>>24&255,i[61]=o[1]>>>16&255,i[62]=o[1]>>>8&255,i[63]=255&o[1],a(i,n)):(u[56]=o[0]>>>24&255,u[57]=o[0]>>>16&255,u[58]=o[0]>>>8&255,u[59]=255&o[0],u[60]=o[1]>>>24&255,u[61]=o[1]>>>16&255,u[62]=o[1]>>>8&255,u[63]=255&o[1],a(i,n),a(u,n));for(var c=0,v="";c<n.length;++c)v+=("00000000"+(n[c]>>>0).toString(16)).slice(-8);return v}function t(r,n){var e=n<<3>>>0;r[1]+=e,r[0]+=(n>>>29)+(r[1]<e)}function a(r,n){for(var e=0;e+64<=r.length;e+=64){for(var o=0,t=e;o<16;++o,t+=4)f[o]=r[t]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3];for(var o=16;o<80;++o)f[o]=f[o-3]^f[o-8]^f[o-14]^f[o-16],f[o]=f[o]<<1|f[o]>>>31;for(var a=0,i=n[0],u=n[1],h=n[2],d=n[3],c=n[4],o=0;o<20;++o)a=(i<<5|i>>>27)+(u&h|~u&d)+c+f[o]+1518500249,c=d,d=h,h=u<<30|u>>>2,u=i,i=a;for(var o=20;o<40;++o)a=(i<<5|i>>>27)+(u^h^d)+c+f[o]+1859775393,c=d,d=h,h=u<<30|u>>>2,u=i,i=a;for(var o=40;o<60;++o)a=(i<<5|i>>>27)+(u&h|u&d|h&d)+c+f[o]+2400959708,c=d,d=h,h=u<<30|u>>>2,u=i,i=a;for(var o=60;o<80;++o)a=(i<<5|i>>>27)+(u^h^d)+c+f[o]+3395469782,c=d,d=h,h=u<<30|u>>>2,u=i,i=a;n[0]=n[0]+i&4294967295,n[1]=n[1]+u&4294967295,n[2]=n[2]+h&4294967295,n[3]=n[3]+d&4294967295,n[4]=n[4]+c&4294967295}}var f=new Array(80),i=new Array(64),u=new Array(64);"function"==typeof define&&define.amd?define(function(){return o}):"undefined"!=typeof exports&&"undefined"!=typeof module?module.exports=o:r.sha1=o}("undefined"==typeof window?this:window);