@li0ard/magma

Magma cipher implementation in pure TypeScript

https://github.com/li0ard/magma

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (7.9%) to scientific vocabulary

Keywords

crypto gost magma streebog
Last synced: 6 months ago · JSON representation ·

Repository

Magma cipher implementation in pure TypeScript

Basic Info
Statistics
  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • Open Issues: 0
  • Releases: 8
Topics
crypto gost magma streebog
Created 8 months ago · Last pushed 7 months ago
Metadata Files
Readme License Citation

README.md

@li0ard/magma
Magma cipher implementation 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/magma

from JSR

bunx jsr i @li0ard/magma ```

Supported modes (GOST R 34.12-2015)

  • [x] Electronic Codebook (ECB)
  • [x] Cipher Block Chaining (CBC)
  • [x] Cipher Feedback (CFB)
  • [x] Counter (CTR)
  • [x] Output Feedback (OFB)
  • [x] MAC (CMAC/OMAC)
  • [x] Counter with Advance Cryptographic Prolongation of Key Material (CTR-ACPKM)
  • [x] MAC with Advance Cryptographic Prolongation of Key Material (OMAC-ACPKM)
  • [x] Multilinear Galois Mode (MGM)
  • [x] KExp15/KImp15 key export/import (P 1323565.1.017 (in Russian))

Supported modes (GOST 28147-89)

  • [x] Electronic Codebook (ECB)
  • [x] Cipher Block Chaining (CBC)
  • [x] Cipher Feedback (CFB)
  • [x] Counter (CNT)
  • [x] MAC
  • [x] Key wrapping (RFC 4357)

Features

Examples

ECB mode

```ts import { decryptECB, encryptECB } from "@li0ard/magma";

const key = Buffer.from("ffeeddccbbaa99887766554433221100f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff", "hex") const plaintext = Buffer.from("fedcba9876543210", "hex") const encrypted = encryptECB(key, plaintext) console.log(encrypted) // Uint8Array [ ... ]

const decrypted = decryptECB(key, encrypted) console.log(decrypted) // Uint8Array [ ... ] ```

CTR-ACPKM mode

```ts import { decryptCTRACPKM, encryptCTRACPKM } from "@li0ard/magma"

const key = Buffer.from("8899AABBCCDDEEFF0011223344556677FEDCBA98765432100123456789ABCDEF", "hex") const iv = Buffer.from("12345678", "hex") const plaintext = Buffer.from("1122334455667700FFEEDDCCBBAA998800112233445566778899AABBCCEEFF0A112233445566778899AABBCCEEFF0A002233445566778899", "hex")

const encrypted = encryptCTR_ACPKM(key, plaintext, iv) console.log(encrypted) // Uint8Array [...]

const decrypted = decryptCTR_ACPKM(key, encrypted, iv) console.log(decrypted) // Uint8Array [...] ```

ECB mode (GOST 28147-89)

```ts import { decryptECB, encryptECB, sboxes } from "@li0ard/magma";

const key = Buffer.from("0475f6e05038fbfad2c7c390edb3ca3d1547124291ae1e8a2f79cd9ed2bcefbd", "hex") const plaintext = Buffer.from("07060504030201000f0e0d0c0b0a090817161514131211101f1e1d1c1b1a191827262524232221202f2e2d2c2b2a292837363534333231303f3e3d3c3b3a393847464544434241404f4e4d4c4b4a494857565554535251505f5e5d5c5b5a595867666564636261606f6e6d6c6b6a696877767574737271707f7e7d7c7b7a797887868584838281808f8e8d8c8b8a898897969594939291909f9e9d9c9b9a9998a7a6a5a4a3a2a1a0afaeadacabaaa9a8b7b6b5b4b3b2b1b0bfbebdbcbbbab9b8c7c6c5c4c3c2c1c0cfcecdcccbcac9c8d7d6d5d4d3d2d1d0dfdedddcdbdad9d8e7e6e5e4e3e2e1e0efeeedecebeae9e8f7f6f5f4f3f2f1f0fffefdfcfbfaf9f8", "hex") const encrypted = encryptECB(key, plaintext, true, sboxes.IDGOST2814789TESTPARAMSET) console.log(encrypted) // Uint8Array [ ... ]

const decrypted = decryptECB(key, encrypted, true, sboxes.IDGOST2814789TESTPARAMSET) console.log(decrypted) // Uint8Array [ ... ] ```

Owner

  • Name: Artem Petrenko
  • Login: li0ard
  • Kind: user
  • Location: Amsterdam

- CEO at @nextlng; Web admin at @tosvasq

Citation (CITATION.cff)

# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: '@li0ard/magma'
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - given-names: Nikolai
    family-names: Konovalov
    email: li0ard@li0ard.rest
    affiliation: TheInfinityWay
    orcid: 'https://orcid.org/0009-0008-6084-7154'
repository-code: 'https://github.com/li0ard/magma'
abstract: Magma cipher implementation in pure TypeScript
keywords:
  - gost
  - crypto
  - magma
  - streebog
license: MIT

GitHub Events

Total
  • Release event: 7
  • Push event: 7
  • Create event: 8
Last Year
  • Release event: 7
  • Push event: 7
  • Create event: 8

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 6
  • Total Committers: 1
  • Avg Commits per committer: 6.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 6
  • Committers: 1
  • Avg Commits per committer: 6.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Lizard l****d@p****e 6
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 7 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • npm 67 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 10
  • Total maintainers: 1
npmjs.org: @li0ard/magma

Magma cipher implementation in pure TypeScript

  • Versions: 10
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 67 Last month
Rankings
Dependent repos count: 24.3%
Average: 29.6%
Dependent packages count: 35.0%
Maintainers (1)
Last synced: 6 months ago

Dependencies

.github/workflows/docs.yml actions
  • actions/checkout v4 composite
  • actions/configure-pages v3 composite
  • actions/deploy-pages v4 composite
  • actions/upload-pages-artifact v3 composite
  • oven-sh/setup-bun v2 composite
.github/workflows/jsr.yml actions
  • actions/checkout v4 composite
  • oven-sh/setup-bun v2 composite
.github/workflows/npm.yml actions
  • actions/checkout v4 composite
  • oven-sh/setup-bun v2 composite
.github/workflows/test.yml actions
  • actions/checkout v4 composite
  • oven-sh/setup-bun v2 composite
package.json npm
  • @types/bun latest development
  • typedoc ^0.28.7 development
  • @li0ard/gost3413 ^0.1.4