GithubHelp home page GithubHelp logo

aykxt / crypto Goto Github PK

View Code? Open in Web Editor NEW
52.0 3.0 2.0 162 KB

๐Ÿ” Fastest crypto library for Deno written in pure Typescript. AES, Blowfish, CAST5, DES, 3DES, HMAC, HKDF, PBKDF2

Home Page: https://deno.land/x/crypto

License: MIT License

TypeScript 100.00%
deno crypto typescript aes blowfish hmac hkdf pbkdf2 ciphers cast5

crypto's Introduction



๐ŸŒ Socials:

LinkedIn Reddit Twitter

๐Ÿ’ป Tech Stack:

Go HTML5 JavaScript Kotlin Python Rust CSS3 Cloudflare Firebase Google Cloud DigitalOcean Vercel Bootstrap MUI JWT React Router React Vue.js Flutter Nginx SQLite Supabase MongoDB Postgres Adobe Illustrator Adobe Photoshop Figma Docker Gradle Postman NPM Express.js NodeJS Markdown TypeScript Dart

๐Ÿ† GitHub Trophies

Help me by Donating

PayPal


crypto's People

Contributors

aykxt avatar nkeor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

crypto's Issues

[Feature request] Implement AES-IGE

Hi there! First of all, love your lib. Just started getting into Deno myself and it's nice to see a good crypto library already exists. I'm working on porting another very large project to Deno, and it requires the AES-IGE block cipher. IGE isn't used much at all except by Telegram for their MTProto protocol, but it would be really helpful to me to have it available in your library.

Why my AES result wrong?

My typescript AES result is different from golang language, typescript is client language, and golang is my server language.

Then I try some AES website like https://the-x.cn/en-US/cryptography/Aes.aspx, and I found golang AES result is same as the website AES result.

Here is my code.

const te = new TextEncoder();
const key = te.encode("1234567899999999");
const data = te.encode("1234");

const iv = new Uint8Array(16)
for (let i = 0; i < key.length; i++) {
	iv[i] = key[i]
}

const cipher = new Cbc(Aes, key, iv, Padding.PKCS7);
const encrypted = cipher.encrypt(data);
const base64 = Base64.encode(encrypted)

The typescript AES result = CbV6UFL7HC7H1smYlwliVg==
The golang AES result = S7gxtGIbOdtmzhn4vAW13A==
The website AES result = S7gxtGIbOdtmzhn4vAW13A==

It's so strange and I am checking my code, does my code has any problem?

error: Invalid key size (must be either 16, 24 or 32 bytes)

Hello, I just see this Deno module and I want to use it.

here is my code:

import { Aes } from 'https://deno.land/x/[email protected]/aes.ts';
import { Cbc, Padding } from 'https://deno.land/x/[email protected]/block-modes.ts';

export default function encrypt(encData: string, encKey: string) {
  const te = new TextEncoder();

  const key = te.encode(encKey);
  const data = te.encode(encData);
  const iv = new Uint8Array(16);

  const cipher = new Cbc(Aes, key, iv, Padding.PKCS7);

  return cipher.encrypt(data);
}

however, running

console.log(encrypt("ABC123456", "VeryStrongPassword"));

return this error

error: Uncaught Error: Invalid key size (must be either 16, 24 or 32 bytes)
      throw new Error("Invalid key size (must be either 16, 24 or 32 bytes)");

How do I fix this? New to Deno.

Thank you (and sorry in case this is a foolish question).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.