https://github.com/li0ard/gostcurves
GOST R 34.10 curves and DSA in pure TypeScript
https://github.com/li0ard/gostcurves
crypto ecc gost gost3410 streebog
Last synced: 3 months ago
JSON representation
GOST R 34.10 curves and DSA in pure TypeScript
- Host: GitHub
- URL: https://github.com/li0ard/gostcurves
- Owner: li0ard
- License: mit
- Created: 2025-07-23T08:43:38.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-07-23T08:50:29.000Z (3 months ago)
- Last Synced: 2025-07-23T08:59:52.853Z (3 months ago)
- Topics: crypto, ecc, gost, gost3410, streebog
- Language: TypeScript
- Homepage: http://li0ard.is-cool.dev/gostcurves
- Size: 0 Bytes
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Citation: CITATION.cff
Awesome Lists containing this project
README
@li0ard/gostcurves
GOST R 34.10 curves and DSA in pure TypeScript
docs
![]()
![]()
![]()
![]()
> [!WARNING]
> This library is currently in alpha stage: the lib is not very stable yet, and there may be a lot of bugs
> feel free to try it out, though, any feedback is appreciated!## Installation
```bash
# from NPM
npm i @li0ard/gostcurves# from JSR
bunx jsr i @li0ard/gostcurves
```## Usage
### Create signature```ts
import { ID_GOSTR3410_2012_256_PARAM_SET_A, sign, verify, getPublicKey } from "@li0ard/gostcurves";let curve = ID_GOSTR3410_2012_256_PARAM_SET_A;
let privKey = hexToBytes("0ca68a44333dbee1daea1e80dbdd560a43215886a392472b898ed3721e1177e0");
let publicKey = getPublicKey(curve, privKey);
let digest = hexToBytes("2dfbc1b372d89a1188c09c52e0eec61fce52032ab1022e8e67ece6672b043ee5");let signature = sign(curve, privKey, digest);
console.log(signature); // -> Uint8Array [...]
console.log(verify(curve, publicKey, digest, signature)); // -> true
```### Create shared key with VKO algorithm
```ts
import { ID_GOSTR3410_2012_512_PARAM_SET_A, getPublicKey, kek_34102012256 } from "@li0ard/gostcurves"let curve = ID_GOSTR3410_2012_512_PARAM_SET_A;
let ukm = hexToBytes("27c744853c60801d")let alicePriv = hexToBytes("67b63ca4ac8d2bb32618d89296c7476dbeb9f9048496f202b1902cf2ce41dbc2f847712d960483458d4b380867f426c7ca0ff5782702dbc44ee8fc72d9ec90c9");
let bobPriv = hexToBytes("dbd09213a592da5bbfd8ed068cccccbbfbeda4feac96b9b4908591440b0714803b9eb763ef932266d4c0181a9b73eacf9013efc65ec07c888515f1b6f759c848");let alicePub = getPublicKey(curve, alicePriv);
let bobPub = getPublicKey(curve, bobPriv);console.log(kek_34102012256(curve, alicePriv, bobPub, ukm)) // -> c9a9a77320e2cc559ed72dce6f47e2192ccea95fa648670582c054c0ef36c221
console.log(kek_34102012256(curve, bobPriv, alicePub, ukm)) // -> c9a9a77320e2cc559ed72dce6f47e2192ccea95fa648670582c054c0ef36c221
```