gitiumiota
Version:
IOTA Client Reference Implementation
54 lines (34 loc) • 1.37 kB
Markdown
Add, remove and validate checksums.
Install using [npm](https://www.npmjs.org/):
```
npm install @iota/checksum
```
or using [yarn](https://yarnpkg.com/):
``` yarn
yarn add @iota/checksum
```
<a name="module_checksum..addChecksum"></a>
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| input | <code>string</code> | | Input trytes |
| [checksumLength] | <code>number</code> | <code>9</code> | Checksum trytes length |
| [isAddress] | <code>boolean</code> | <code>true</code> | Flag to denote if given input is address. Defaults to `true`. |
Generates and appends the 9-tryte checksum of the given trytes, usually an address.
**Returns**: <code>string</code> - Address (with checksum)
<a name="module_checksum..removeChecksum"></a>
| Param | Type | Description |
| --- | --- | --- |
| input | <code>string</code> | Input trytes |
Removes the 9-trytes checksum of the given input.
**Returns**: <code>string</code> - Trytes without checksum
<a name="module_checksum..isValidChecksum"></a>
| Param | Type |
| --- | --- |
| addressWithChecksum | <code>string</code> |
Validates the checksum of the given address trytes.