Skip to content

Commit

Permalink
Simplify a few return statements
Browse files Browse the repository at this point in the history
  • Loading branch information
Caligatio committed Apr 29, 2020
1 parent 738aa33 commit 5ba442b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
21 changes: 10 additions & 11 deletions src/sha3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -577,17 +577,16 @@ export default class jsSHA extends jsSHABase<Int_64[][], VariantType> {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
protected _getKMAC(options: { outputLen: number }): number[] {
const concatedRemainder = packedLEConcat(
{ value: this.remainder.slice(), binLen: this.remainderLen },
right_encode(options["outputLen"])
),
finalizedState = this.finalizeFunc(
concatedRemainder["value"],
concatedRemainder["binLen"],
this.processedLen,
this.stateCloneFunc(this.intermediateState),
options["outputLen"]
);
{ value: this.remainder.slice(), binLen: this.remainderLen },
right_encode(options["outputLen"])
);

return finalizedState;
return this.finalizeFunc(
concatedRemainder["value"],
concatedRemainder["binLen"],
this.processedLen,
this.stateCloneFunc(this.intermediateState),
options["outputLen"]
);
}
}
7 changes: 2 additions & 5 deletions src/sha512.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,8 @@ const K_sha512 = [
* @returns The initial state values.
*/
function getNewState512(variant: VariantType): Int_64[] {
let retVal;

if ("SHA-384" === variant) {
retVal = [
return [
new Int_64(0xcbbb9d5d, H_trunc[0]),
new Int_64(0x0629a292a, H_trunc[1]),
new Int_64(0x9159015a, H_trunc[2]),
Expand All @@ -126,7 +124,7 @@ function getNewState512(variant: VariantType): Int_64[] {
];
} else {
/* SHA-512 */
retVal = [
return [
new Int_64(H_full[0], 0xf3bcc908),
new Int_64(H_full[1], 0x84caa73b),
new Int_64(H_full[2], 0xfe94f82b),
Expand All @@ -137,7 +135,6 @@ function getNewState512(variant: VariantType): Int_64[] {
new Int_64(H_full[7], 0x137e2179),
];
}
return retVal;
}

/**
Expand Down

0 comments on commit 5ba442b

Please sign in to comment.