forked from tornado-packages/noble-curves
ed25519, ed448: rename hash_to_ristretto to hashToRistretto. And decaf
This commit is contained in:
parent
8c48abe16a
commit
ca5583f713
@ -480,10 +480,11 @@ export const RistrettoPoint = /* @__PURE__ */ (() => {
|
|||||||
|
|
||||||
// https://datatracker.ietf.org/doc/draft-irtf-cfrg-hash-to-curve/14/
|
// https://datatracker.ietf.org/doc/draft-irtf-cfrg-hash-to-curve/14/
|
||||||
// Appendix B. Hashing to ristretto255
|
// Appendix B. Hashing to ristretto255
|
||||||
export const hash_to_ristretto255 = (msg: Uint8Array, options: htfBasicOpts) => {
|
export const hashToRistretto255 = (msg: Uint8Array, options: htfBasicOpts) => {
|
||||||
const d = options.DST;
|
const d = options.DST;
|
||||||
const DST = typeof d === 'string' ? utf8ToBytes(d) : d;
|
const DST = typeof d === 'string' ? utf8ToBytes(d) : d;
|
||||||
const uniform_bytes = expand_message_xmd(msg, DST, 64, sha512);
|
const uniform_bytes = expand_message_xmd(msg, DST, 64, sha512);
|
||||||
const P = RistPoint.hashToCurve(uniform_bytes);
|
const P = RistPoint.hashToCurve(uniform_bytes);
|
||||||
return P;
|
return P;
|
||||||
};
|
};
|
||||||
|
export const hash_to_ristretto255 = hashToRistretto255; // legacy
|
||||||
|
@ -456,10 +456,11 @@ export const DecafPoint = /* @__PURE__ */ (() => {
|
|||||||
|
|
||||||
// https://datatracker.ietf.org/doc/draft-irtf-cfrg-hash-to-curve/16/
|
// https://datatracker.ietf.org/doc/draft-irtf-cfrg-hash-to-curve/16/
|
||||||
// Appendix C. Hashing to decaf448
|
// Appendix C. Hashing to decaf448
|
||||||
export const hash_to_decaf448 = (msg: Uint8Array, options: htfBasicOpts) => {
|
export const hashToDecaf448 = (msg: Uint8Array, options: htfBasicOpts) => {
|
||||||
const d = options.DST;
|
const d = options.DST;
|
||||||
const DST = typeof d === 'string' ? utf8ToBytes(d) : d;
|
const DST = typeof d === 'string' ? utf8ToBytes(d) : d;
|
||||||
const uniform_bytes = expand_message_xof(msg, DST, 112, 224, shake256);
|
const uniform_bytes = expand_message_xof(msg, DST, 112, 224, shake256);
|
||||||
const P = DcfPoint.hashToCurve(uniform_bytes);
|
const P = DcfPoint.hashToCurve(uniform_bytes);
|
||||||
return P;
|
return P;
|
||||||
};
|
};
|
||||||
|
export const hash_to_decaf448 = hashToDecaf448; // legacy
|
||||||
|
Loading…
Reference in New Issue
Block a user