Merge pull request #27 from 002Hub/deepsource-fix-d0ffa19b
Fix Yoda conditions
This commit is contained in:
commit
242f7ad3df
@ -1,4 +1,4 @@
|
|||||||
var sha256=function a(b){function c(a,b){return a>>>b|a<<32-b}for(var d,e,f=Math.pow,g=f(2,32),h="length",i="",j=[],k=8*b[h],l=a.h=a.h||[],m=a.k=a.k||[],n=m[h],o={},p=2;64>n;p++)if(!o[p]){for(d=0;313>d;d+=p)o[d]=p;l[n]=f(p,.5)*g|0,m[n++]=f(p,1/3)*g|0}for(b+="\x80";b[h]%64-56;)b+="\x00";for(d=0;d<b[h];d++){if(e=b.charCodeAt(d),e>>8)return;j[d>>2]|=e<<(3-d)%4*8}for(j[j[h]]=k/g|0,j[j[h]]=k,e=0;e<j[h];){var q=j.slice(e,e+=16),r=l;for(l=l.slice(0,8),d=0;64>d;d++){var s=q[d-15],t=q[d-2],u=l[0],v=l[4],w=l[7]+(c(v,6)^c(v,11)^c(v,25))+(v&l[5]^~v&l[6])+m[d]+(q[d]=16>d?q[d]:q[d-16]+(c(s,7)^c(s,18)^s>>>3)+q[d-7]+(c(t,17)^c(t,19)^t>>>10)|0),x=(c(u,2)^c(u,13)^c(u,22))+(u&l[1]^u&l[2]^l[1]&l[2]);l=[w+x|0].concat(l),l[4]=l[4]+w|0}for(d=0;8>d;d++)l[d]=l[d]+r[d]|0}for(d=0;8>d;d++)for(e=3;e+1;e--){var y=l[d]>>8*e&255;i+=(16>y?0:"")+y.toString(16)}return i};
|
var sha256=function a(b){function c(a,b){return a>>>b|a<<32-b}for(var d,e,f=Math.pow,g=f(2,32),h="length",i="",j=[],k=8*b[h],l=a.h=a.h||[],m=a.k=a.k||[],n=m[h],o={},p=2;n<64;p++)if(!o[p]){for(d=0;d<313;d+=p)o[d]=p;l[n]=f(p,.5)*g|0,m[n++]=f(p,1/3)*g|0}for(b+="\x80";b[h]%64-56;)b+="\x00";for(d=0;d<b[h];d++){if(e=b.charCodeAt(d),e>>8)return;j[d>>2]|=e<<(3-d)%4*8}for(j[j[h]]=k/g|0,j[j[h]]=k,e=0;e<j[h];){var q=j.slice(e,e+=16),r=l;for(l=l.slice(0,8),d=0;d<64;d++){var s=q[d-15],t=q[d-2],u=l[0],v=l[4],w=l[7]+(c(v,6)^c(v,11)^c(v,25))+(v&l[5]^~v&l[6])+m[d]+(q[d]=d<16?q[d]:q[d-16]+(c(s,7)^c(s,18)^s>>>3)+q[d-7]+(c(t,17)^c(t,19)^t>>>10)|0),x=(c(u,2)^c(u,13)^c(u,22))+(u&l[1]^u&l[2]^l[1]&l[2]);l=[w+x|0].concat(l),l[4]=l[4]+w|0}for(d=0;d<8;d++)l[d]=l[d]+r[d]|0}for(d=0;d<8;d++)for(e=3;e+1;e--){var y=l[d]>>8*e&255;i+=(y<16?0:"")+y.toString(16)}return i};
|
||||||
|
|
||||||
function hash(str,salt,num) {
|
function hash(str,salt,num) {
|
||||||
if(!num && num!==0)num=1;
|
if(!num && num!==0)num=1;
|
||||||
|
@ -667,7 +667,7 @@ router.post("/api/setBio", async function (req, res) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bio = encodeURIComponent(bio);
|
bio = encodeURIComponent(bio);
|
||||||
if (100 < bio.length) {
|
if (bio.length > 100) {
|
||||||
res.status(400);
|
res.status(400);
|
||||||
res.json({ "error": "the bio is too long!" });
|
res.json({ "error": "the bio is too long!" });
|
||||||
return;
|
return;
|
||||||
@ -736,7 +736,7 @@ router.post("/api/changeUsername", async function (req, res) {
|
|||||||
res.json({ "error": "incorrect password" });
|
res.json({ "error": "incorrect password" });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (100 < req.body.newUsername.length) {
|
if (req.body.newUsername.length > 100) {
|
||||||
res.status(400);
|
res.status(400);
|
||||||
res.json({ "error": "username is too long" });
|
res.json({ "error": "username is too long" });
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user