Use hashtypes(c.f Cytoplasm#47) (#57)

This makes Telodendria compatible with Telodendria/Cytoplasm#47.

---

Please review the developer certificate of origin:

1. The contribution was created in whole or in part by me, and I have
the right to submit it under the open source licenses of the
Telodendria project; or
1. The contribution is based upon a previous work that, to the best of
my knowledge, is covered under an appropriate open source license and
I have the right under that license to submit that work with
modifications, whether created in whole or in part by me, under the
Telodendria project license; or
1. The contribution was provided directly to me by some other person
who certified (1), (2), or (3), and I have not modified it.
1. I understand and agree that this project and the contribution are
made public and that a record of the contribution—including all
personal information I submit with it—is maintained indefinitely
and may be redistributed consistent with this project or the open
source licenses involved.

- [x] I have read the Telodendria Project development certificate of
origin, and I certify that I have permission to submit this patch
under the conditions specified in it.

Co-authored-by: Jordan Bancino <jordan@bancino.net>
Co-authored-by: LDA <lda@ari.lt>
Reviewed-on: Telodendria/Telodendria#57
Co-authored-by: lda <lda@freetards.xyz>
Co-committed-by: lda <lda@freetards.xyz>
This commit is contained in:
lda 2024-08-27 09:47:25 -04:00 committed by Jordan Bancino
parent 6dd4440125
commit 775b1d9571

View file

@ -384,7 +384,7 @@ UserCheckPassword(User * user, char *password)
tmp = StrConcat(2, password, salt); tmp = StrConcat(2, password, salt);
hashBytes = Sha256(tmp); hashBytes = Sha256(tmp);
hashedPwd = ShaToHex(hashBytes); hashedPwd = ShaToHex(hashBytes, HASH_SHA256);
Free(tmp); Free(tmp);
Free(hashBytes); Free(hashBytes);
@ -415,7 +415,7 @@ UserSetPassword(User * user, char *password)
salt = StrRandom(16); salt = StrRandom(16);
tmpstr = StrConcat(2, password, salt); tmpstr = StrConcat(2, password, salt);
hashBytes = Sha256(tmpstr); hashBytes = Sha256(tmpstr);
hash = ShaToHex(hashBytes); hash = ShaToHex(hashBytes, HASH_SHA256);
JsonValueFree(HashMapSet(json, "salt", JsonValueString(salt))); JsonValueFree(HashMapSet(json, "salt", JsonValueString(salt)));
JsonValueFree(HashMapSet(json, "password", JsonValueString(hash))); JsonValueFree(HashMapSet(json, "password", JsonValueString(hash)));