# upload.getCdnFileHashes

Get SHA256 hashes for verifying downloaded [CDN](https://core.telegram.org/cdn) files

## Example

{% tabs %}
{% tab title="Javascript" %}

```javascript
const {Api, TelegramClient} = require('telegram');
const {StringSession} = require('telegram/sessions');

const session = new StringSession('');
const client = new TelegramClient(session, apiId, apiHash, {});

(async function run() {
    const result = await client.invoke(new Api.upload.getCdnFileHashes({
        fileToken: Buffer.from('some bytes here'),
        offset: 1930220,
        }));
    console.log(result); // prints the result
})();
```

{% endtab %}

{% tab title="TypeScript" %}

```typescript
import {Api, TelegramClient} from 'telegram';
import {StringSession} from 'telegram/sessions';

const session = new StringSession('');
const client = new TelegramClient(session, apiId, apiHash, {});

(async function run() {
    const result: Api.Vector<FileHash> = await client.invoke(new Api.upload.getCdnFileHashes({
        fileToken: Buffer.from('some bytes here'),
        offset: 1930220,
        }));
    console.log(result); // prints the result
})();
```

{% endtab %}
{% endtabs %}

## TL schema

```
---functions---
upload.getCdnFileHashes#4da54231 file_token:bytes offset:int = Vector<FileHash>;
```

## Parameters

|       Name      | Type                                          | Description                               |
| :-------------: | --------------------------------------------- | ----------------------------------------- |
| **file\_token** | [bytes](https://core.telegram.org/type/bytes) | File                                      |
|    **offset**   | [int](https://core.telegram.org/type/int)     | Offset from which to start getting hashes |

## Result

[Vector](https://core.telegram.org/type/Vector%20t)[\[FileHash\](https://core.telegram.org/type/FileHash)](https://app.gitbook.com/s/-MMkAn4QUh4dOGfc-vjY/working-with-files/\[FileHash]\(https://core.telegram.org/type/FileHash\))

## Possible errors

| Code | Type                 | Description                            |
| :--: | -------------------- | -------------------------------------- |
|  400 | CDN\_METHOD\_INVALID | You can't call this method in a CDN DC |
|  400 | RSA\_DECRYPT\_FAILED | Internal RSA decryption failed         |

## Can bots use this methd ?

### yes

## Related pages

### [Encrypted CDNs for Speed and Security](https://core.telegram.org/cdn)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://painor.gitbook.io/gramjs/working-with-files/upload.getcdnfilehashes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
