Forums WoW Modding Support Archives Azerothcore Discord Archives [DiscordArchive] what's the error?

[DiscordArchive] what's the error?

[DiscordArchive] what's the error?

Pages (3): Previous 1 2 3
rektbyfaith
Administrator
0
12-09-2022, 11:37 AM
#21
Archived author: Aspect • Posted: 2022-12-09T11:37:17.698000+00:00
Original source

```ts
// @ ts-ignore
import sha1 from 'js-sha1'
import { BigInteger } from 'jsbn'

export async function createVerifier(username: string, password: string, salt: Uint8Array) {
const N = new BigInteger("894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7", 16)
const g = new BigInteger("7", 16)

const h1 = Buffer.from(sha1.arrayBuffer(`${username}:${password}`.toUpperCase()))

const h2 = Buffer.from(sha1.arrayBuffer(Buffer.concat([salt, h1]))).reverse()

const h2bigint = new BigInteger(h2.toString("hex"), 16)

const verifierBigint = g.modPow(h2bigint, N)

let verifier = Buffer.from(verifierBigint.toByteArray()).reverse()

verifier = verifier.slice(0, 32)
if (verifier.length != 32) {
verifier = Buffer.concat([verifier], 32)
}

return verifier
}```
rektbyfaith
12-09-2022, 11:37 AM #21

Archived author: Aspect • Posted: 2022-12-09T11:37:17.698000+00:00
Original source

```ts
// @ ts-ignore
import sha1 from 'js-sha1'
import { BigInteger } from 'jsbn'

export async function createVerifier(username: string, password: string, salt: Uint8Array) {
const N = new BigInteger("894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7", 16)
const g = new BigInteger("7", 16)

const h1 = Buffer.from(sha1.arrayBuffer(`${username}:${password}`.toUpperCase()))

const h2 = Buffer.from(sha1.arrayBuffer(Buffer.concat([salt, h1]))).reverse()

const h2bigint = new BigInteger(h2.toString("hex"), 16)

const verifierBigint = g.modPow(h2bigint, N)

let verifier = Buffer.from(verifierBigint.toByteArray()).reverse()

verifier = verifier.slice(0, 32)
if (verifier.length != 32) {
verifier = Buffer.concat([verifier], 32)
}

return verifier
}```

Pages (3): Previous 1 2 3
Recently Browsing
 1 Guest(s)
Recently Browsing
 1 Guest(s)