| 946 | } |
| 947 | |
| 948 | export function hash<Alg extends util.HashAlgorithm, Enc extends util.HashEncoding = "hex">( |
| 949 | alg: Alg, |
| 950 | params?: { |
| 951 | enc?: Enc; |
| 952 | } & core.$ZodStringFormatParams |
| 953 | ): ZodCustomStringFormat<`${Alg}_${Enc}`> { |
| 954 | const enc = params?.enc ?? "hex"; |
| 955 | const format = `${alg}_${enc}` as const; |
| 956 | const regex = core.regexes[format as keyof typeof core.regexes] as RegExp; |
| 957 | if (!regex) throw new Error(`Unrecognized hash format: ${format}`); |
| 958 | return core._stringFormat(ZodCustomStringFormat, format, regex, params) as any; |
| 959 | } |
| 960 | |
| 961 | // ZodNumber |
| 962 | export interface _ZodNumber<Internals extends core.$ZodNumberInternals = core.$ZodNumberInternals> |