Skip to content

Commit

Permalink
Merge pull request #58 from sublimator/nd-validate-dst-as-stringoruin…
Browse files Browse the repository at this point in the history
…t8array-closes-57-2023-06-22

fix: validate hash_to_field DST as stringOrUint8Array (closes #57)
  • Loading branch information
paulmillr committed Jun 22, 2023
2 parents 62e806c + bf70ba9 commit c2edc97
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/abstract/hash-to-curve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export function expand_message_xof(
*/
export function hash_to_field(msg: Uint8Array, count: number, options: Opts): bigint[][] {
validateObject(options, {
DST: 'string',
DST: 'stringOrUint8Array',
p: 'bigint',
m: 'isSafeInteger',
k: 'isSafeInteger',
Expand Down
1 change: 1 addition & 0 deletions src/abstract/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ const validatorFns = {
function: (val: any) => typeof val === 'function',
boolean: (val: any) => typeof val === 'boolean',
string: (val: any) => typeof val === 'string',
stringOrUint8Array: (val: any) => typeof val === 'string' || val instanceof Uint8Array,
isSafeInteger: (val: any) => Number.isSafeInteger(val),
array: (val: any) => Array.isArray(val),
field: (val: any, object: any) => (object as any).Fp.isValid(val),
Expand Down

0 comments on commit c2edc97

Please sign in to comment.