Skip to content

Commit

Permalink
Merge pull request #62 from steveluscher/pure-and-twisted
Browse files Browse the repository at this point in the history
Add pure annotation to all calls to `twistedEdwards`
  • Loading branch information
paulmillr authored Jul 1, 2023
2 parents cf17f7f + 413725c commit 476e751
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
9 changes: 6 additions & 3 deletions src/ed25519.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const ed25519Defaults = {
uvRatio,
} as const;

export const ed25519 = twistedEdwards(ed25519Defaults);
export const ed25519 = /* @__PURE__ */ twistedEdwards(ed25519Defaults);

function ed25519_domain(data: Uint8Array, ctx: Uint8Array, phflag: boolean) {
if (ctx.length > 255) throw new Error('Context is too big');
Expand All @@ -135,8 +135,11 @@ function ed25519_domain(data: Uint8Array, ctx: Uint8Array, phflag: boolean) {
);
}

export const ed25519ctx = twistedEdwards({ ...ed25519Defaults, domain: ed25519_domain });
export const ed25519ph = twistedEdwards({
export const ed25519ctx = /* @__PURE__ */ twistedEdwards({
...ed25519Defaults,
domain: ed25519_domain,
});
export const ed25519ph = /* @__PURE__ */ twistedEdwards({
...ed25519Defaults,
domain: ed25519_domain,
prehash: sha512,
Expand Down
4 changes: 2 additions & 2 deletions src/ed448.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ const ED448_DEF = {
uvRatio,
} as const;

export const ed448 = twistedEdwards(ED448_DEF);
export const ed448 = /* @__PURE__ */ twistedEdwards(ED448_DEF);
// NOTE: there is no ed448ctx, since ed448 supports ctx by default
export const ed448ph = twistedEdwards({ ...ED448_DEF, prehash: shake256_64 });
export const ed448ph = /* @__PURE__ */ twistedEdwards({ ...ED448_DEF, prehash: shake256_64 });

export const x448 = /* @__PURE__ */ (() =>
montgomery({
Expand Down
2 changes: 1 addition & 1 deletion src/jubjub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Field } from './abstract/modular.js';
* jubjub does not use EdDSA, so `hash`/sha512 params are passed because interface expects them.
*/

export const jubjub = twistedEdwards({
export const jubjub = /* @__PURE__ */ twistedEdwards({
// Params: a, d
a: BigInt('0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000000'),
d: BigInt('0x2a9318e74bfa2b48f5fd9207e6bd7fd4292d7f6d37579d2601065fd6d6343eb1'),
Expand Down

0 comments on commit 476e751

Please sign in to comment.