*/
static async search (hash: string, threshold: number = 0xfffffff8): Promise<string> {
if (NanoPowGl.#gl == null) throw new Error('WebGL 2 is required')
- if (!/^[A-F-a-f0-9]{64}$/.test(hash)) throw new Error(`invalid_hash ${hash}`)
+ if (!/^[A-Fa-f0-9]{64}$/.test(hash)) throw new Error(`Invalid hash ${hash}`)
if (typeof threshold !== 'number') throw new TypeError(`Invalid threshold ${threshold}`)
if (this.#gl == null) throw new Error('WebGL 2 is required')
*/
static async validate (work: string, hash: string, threshold: number = 0xfffffff8): Promise<boolean> {
if (NanoPowGl.#gl == null) throw new Error('WebGL 2 is required')
- if (!/^[A-F-a-f0-9]{16}$/.test(hash)) throw new Error(`invalid_hash ${work}`)
- if (!/^[A-F-a-f0-9]{64}$/.test(hash)) throw new Error(`invalid_hash ${hash}`)
+ if (!/^[A-Fa-f0-9]{16}$/.test(work)) throw new Error(`Invalid work ${work}`)
+ if (!/^[A-Fa-f0-9]{64}$/.test(hash)) throw new Error(`Invalid hash ${hash}`)
if (typeof threshold !== 'number') throw new TypeError(`Invalid threshold ${threshold}`)
if (this.#gl == null) throw new Error('WebGL 2 is required')