MCPcopy Create free account
hub / github.com/ElementsProject/lightning / compare_passphrases

Function compare_passphrases

plugins/exposesecret.c:30–41  ·  view source on GitHub ↗

Don't let compiler do clever things, which would allow the caller * to measure time, and figure out how much of the passphrase matched! */

Source from the content-addressed store, hash-verified

28/* Don't let compiler do clever things, which would allow the caller
29 * to measure time, and figure out how much of the passphrase matched! */
30static bool compare_passphrases(const char *a, const char *b)
31{
32 struct sha256 a_sha, b_sha;
33
34 /* Technically, this gives information about passphrase length, but
35 * they can also just brute force it if it is small, so this doesn't
36 * add much! Also, hashing messes with timing quite a bit. */
37 sha256(&a_sha, a, strlen(a));
38 sha256(&b_sha, b, strlen(b));
39
40 return sha256_eq(&a_sha, &b_sha);
41}
42
43static struct command_result *json_exposesecret(struct command *cmd,
44 const char *buffer,

Callers 1

json_exposesecretFunction · 0.85

Calls 1

sha256Class · 0.70

Tested by

no test coverage detected