MCPcopy Create free account
hub / github.com/lesspass/lesspass / getAlgorithm

Function getAlgorithm

packages/lesspass-crypto/index.ts:20–34  ·  view source on GitHub ↗
(algorithm: string)

Source from the content-addressed store, hash-verified

18}
19
20export function getAlgorithm(algorithm: string) {
21 const algorithms: { [k: string]: string } = {
22 sha1: "SHA-1",
23 "sha-1": "SHA-1",
24 sha256: "SHA-256",
25 "sha-256": "SHA-256",
26 sha512: "SHA-512",
27 "sha-512": "SHA-512"
28 };
29 const lowercaseAlgorithm = algorithm.toLowerCase();
30 if (lowercaseAlgorithm in algorithms) {
31 return algorithms[lowercaseAlgorithm];
32 }
33 return "SHA-256";
34}

Callers 3

test.tsFile · 0.85
pbkdf2.browser.jsFile · 0.85
hmac.browser.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected