question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to get gAHash using gramjs?

See original GitHub issue

I’m trying to call Api.phone.RequestCall. If I use random value for gAHash like Buffer.from("lol12345") I’m getting an error Call error RPCError: 400: DH_G_A_HASH_INVALID (caused by phone.RequestCall)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
painorcommented, Dec 26, 2021

A while ago I made a gist using another library , maybe you can use it and convert it to JS? https://gist.github.com/painor/537cdba90c21b8e64b3e156760775147

1reaction
pablodgonzalezcommented, Nov 9, 2022

@ghost that’s is what I got

function int_256_to_bytes(int: bigint) {
    const bytesArray = [];
    for (let i = 0; i < 32; i++) {
        let shift = int >> BigInt(8 * i)
        shift &= BigInt(255)
        bytesArray[i] = Number(String(shift))
    }
    return Buffer.from(bytesArray)
}


const dhc = await client.invoke(new Api.messages.GetDhConfig({
        version: config.version,
        randomLength: 256
    })) as Api.messages.DhConfig;


    const one = BigInt(1);
    const g = BigInt(dhc.g);
    const p = BigInt(`0x${dhc.p.toString('hex')}`)
    let a = BigInt(0);
    while (a <= 1 && a >= p) {
        a = BigInt(`0x${randomBytes(256).toString('hex')}`);
    }

    const g_a = (g ** a) % p;

    const shag_a = await sha256(int_256_to_bytes(g_a));
Read more comments on GitHub >

github_iconTop Results From Across the Web

phone.RequestCall - GramJS
... This assumes you have already authenticated with .start() const result = await ... gAHash: Buffer.from("arbitrary data here"), protocol: new Api.
Read more >
gramjs: Quick Start
Once you've installed gramjs you'll need an API ID and an API hash (read more in Authorization). Get them from https://my.telegram.org/apps: Afterward, ...
Read more >
GANESHA STATUE IN BRONZE 850 grams GANESH ... - eBay
Beautiful wooden hand crafted mask of hindu deity lord ganesh statue home decor. $115.69. Free shipping. Seller 100% positive ...
Read more >
Buy - Natural Ganesh Rudraksha - 3.11 Grams
Coloured stones are always a challenge as a lot of suppliers don't give you good quality and good certificates. Carat & Colour is...
Read more >
10 Grams Ganesh Silver Coin 99.9 % Purity - jpearls.com
Buy the Best 10 Grams Ganesh Silver Coin 99.9 % Purity Online from Sri Jagdamba Pearls, Certified Jewellery. With High Quality Silver at...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found