Forums WoW Modding Support Archives Azerothcore Discord Archives [DiscordArchive] Hello, where is the createVerifier for SRP6 Auth in AzerothCore please ?

[DiscordArchive] Hello, where is the createVerifier for SRP6 Auth in AzerothCore please ?

[DiscordArchive] Hello, where is the createVerifier for SRP6 Auth in AzerothCore please ?

Pages (2): 1 2 Next
rektbyfaith
Administrator
0
12-09-2022, 09:28 AM
#1
Archived author: Aspect • Posted: 2022-12-09T09:28:16.824000+00:00
Original source

Hello, where is the createVerifier for SRP6 Auth in AzerothCore please ?
rektbyfaith
12-09-2022, 09:28 AM #1

Archived author: Aspect • Posted: 2022-12-09T09:28:16.824000+00:00
Original source

Hello, where is the createVerifier for SRP6 Auth in AzerothCore please ?

rektbyfaith
Administrator
0
12-09-2022, 09:28 AM
#2
Archived author: Aspect • Posted: 2022-12-09T09:28:29.064000+00:00
Original source

i try to pass js to ts and it doesn't work
rektbyfaith
12-09-2022, 09:28 AM #2

Archived author: Aspect • Posted: 2022-12-09T09:28:29.064000+00:00
Original source

i try to pass js to ts and it doesn't work

rektbyfaith
Administrator
0
12-09-2022, 09:58 AM
#3
Archived author: Aspect • Posted: 2022-12-09T09:58:29.599000+00:00
Original source

```ts
import sha1 from '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(username.toUpperCase() + ':' + password), 'hex')

const h2 = Buffer.from(sha1(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, 09:58 AM #3

Archived author: Aspect • Posted: 2022-12-09T09:58:29.599000+00:00
Original source

```ts
import sha1 from '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(username.toUpperCase() + ':' + password), 'hex')

const h2 = Buffer.from(sha1(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
Administrator
0
12-09-2022, 09:58 AM
#4
Archived author: Aspect • Posted: 2022-12-09T09:58:34.951000+00:00
Original source

its my function
rektbyfaith
12-09-2022, 09:58 AM #4

Archived author: Aspect • Posted: 2022-12-09T09:58:34.951000+00:00
Original source

its my function

rektbyfaith
Administrator
0
12-09-2022, 10:18 AM
#5
Archived author: Roboto • Posted: 2022-12-09T10:18:02.759000+00:00
Original source

I have this snippet from an old project, looks very similar to yours but uses a different package for sha1. Might be the solution, or not, idk
```ts
import sha1 from "js-sha1";
import crypto from "crypto";
import { BigInteger } from "jsbn";

export function createVerifier(username: string, password: string, salt: Buffer = null): Buffer {
// https://gist.github.com/Treeston/db44f23...cb8d66781e

const N = new BigInteger("894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7", 16);
const g = new BigInteger("7", 16);
salt = salt || generateSalt();

// Calculate first hash
const h1: Buffer = Buffer.from(sha1.arrayBuffer(`${username}:${password}`.toUpperCase()));

// Calculate second hash
const h2: Buffer = Buffer.from(sha1.arrayBuffer(Buffer.concat([salt, h1]))).reverse();

// Convert to integer
const h2bigint = new BigInteger(h2.toString("hex"), 16);

// g^h2 mod N
const verifierBigint = g.modPow(h2bigint, N);

// Convert back to a buffer
let verifier = Buffer.from(verifierBigint.toByteArray()).reverse();

// Pad to 32 bytes
verifier = verifier.slice(0, 32);
if (verifier.length != 32) {
verifier = Buffer.concat([verifier], 32);
}

return verifier;
};

export function generateSalt(): Buffer {
return crypto.randomBytes(32);
}
```
rektbyfaith
12-09-2022, 10:18 AM #5

Archived author: Roboto • Posted: 2022-12-09T10:18:02.759000+00:00
Original source

I have this snippet from an old project, looks very similar to yours but uses a different package for sha1. Might be the solution, or not, idk
```ts
import sha1 from "js-sha1";
import crypto from "crypto";
import { BigInteger } from "jsbn";

export function createVerifier(username: string, password: string, salt: Buffer = null): Buffer {
// https://gist.github.com/Treeston/db44f23...cb8d66781e

const N = new BigInteger("894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7", 16);
const g = new BigInteger("7", 16);
salt = salt || generateSalt();

// Calculate first hash
const h1: Buffer = Buffer.from(sha1.arrayBuffer(`${username}:${password}`.toUpperCase()));

// Calculate second hash
const h2: Buffer = Buffer.from(sha1.arrayBuffer(Buffer.concat([salt, h1]))).reverse();

// Convert to integer
const h2bigint = new BigInteger(h2.toString("hex"), 16);

// g^h2 mod N
const verifierBigint = g.modPow(h2bigint, N);

// Convert back to a buffer
let verifier = Buffer.from(verifierBigint.toByteArray()).reverse();

// Pad to 32 bytes
verifier = verifier.slice(0, 32);
if (verifier.length != 32) {
verifier = Buffer.concat([verifier], 32);
}

return verifier;
};

export function generateSalt(): Buffer {
return crypto.randomBytes(32);
}
```

rektbyfaith
Administrator
0
12-09-2022, 10:34 AM
#6
Archived author: Aspect • Posted: 2022-12-09T10:34:56.608000+00:00
Original source

Precisely I was using yours before, but I switched to typescript so I tried to make an equivalent, precisely I located that sha1.ArrayBuffer is missing somewhere in relation to Javascript. Only the sha1 package does not offer this to tell the truth... I don't know how to do it
rektbyfaith
12-09-2022, 10:34 AM #6

Archived author: Aspect • Posted: 2022-12-09T10:34:56.608000+00:00
Original source

Precisely I was using yours before, but I switched to typescript so I tried to make an equivalent, precisely I located that sha1.ArrayBuffer is missing somewhere in relation to Javascript. Only the sha1 package does not offer this to tell the truth... I don't know how to do it

rektbyfaith
Administrator
0
12-09-2022, 10:37 AM
#7
Archived author: Aspect • Posted: 2022-12-09T10:37:12.273000+00:00
Original source


[Image: image.png?ex=690bd198&is=690a8018&hm=52f...3c61dde97&]
rektbyfaith
12-09-2022, 10:37 AM #7

Archived author: Aspect • Posted: 2022-12-09T10:37:12.273000+00:00
Original source


[Image: image.png?ex=690bd198&is=690a8018&hm=52f...3c61dde97&]

rektbyfaith
Administrator
0
12-09-2022, 10:37 AM
#8
Archived author: Aspect • Posted: 2022-12-09T10:37:15.650000+00:00
Original source

and me :
rektbyfaith
12-09-2022, 10:37 AM #8

Archived author: Aspect • Posted: 2022-12-09T10:37:15.650000+00:00
Original source

and me :

rektbyfaith
Administrator
0
12-09-2022, 10:37 AM
#9
Archived author: Aspect • Posted: 2022-12-09T10:37:31.447000+00:00
Original source


[Image: image.png?ex=690bd1ab&is=690a802b&hm=73e...ad2d58ee5&]
rektbyfaith
12-09-2022, 10:37 AM #9

Archived author: Aspect • Posted: 2022-12-09T10:37:31.447000+00:00
Original source


[Image: image.png?ex=690bd1ab&is=690a802b&hm=73e...ad2d58ee5&]

rektbyfaith
Administrator
0
12-09-2022, 10:46 AM
#10
Archived author: Roboto • Posted: 2022-12-09T10:46:52.472000+00:00
Original source

ah maybe the package changed since then
rektbyfaith
12-09-2022, 10:46 AM #10

Archived author: Roboto • Posted: 2022-12-09T10:46:52.472000+00:00
Original source

ah maybe the package changed since then

Pages (2): 1 2 Next
Recently Browsing
 1 Guest(s)
Recently Browsing
 1 Guest(s)