Code Monkey home page Code Monkey logo

crypto-ts's People

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

Watchers

 avatar  avatar

crypto-ts's Issues

Modules missing

Most of the modules missing from the package even though they have been listed in the Readme.
(It's only got copied from crypto-js I guess...)
I would need the crypto-ts/hmac-sha384... :)
Also I would gladly help to finish the package.

Inconsistent usage or bug

I have tried the steps described for AES generation for SHA1 / SHA256 without success. I think, this is either a bug or the usage for all cryptos are inconsistent. Please enlighten me.

please export enc.Base64

I am struggling to use Base64 in crypto-ts. I want to return a base64 string of the encryption output. I believe I should use enc.Base64.stringify but I cannot work out how to get it imported using typescript. It looks like it should be added to the following code in src/crypto-ts.ds

    Utf8: typeof Utf8;
    Hex: typeof Hex;
};```

Is it possible to use Base64 in the current version 1.0.2?  Or can we get a new version that makes it available?

`decrypt ∘ encrypt = id` but `encrypt ∘ decrypt ≠ id`

Hi.
I wrote a code:

import { AES, enc } from 'crypto-ts'

const essence: Readonly<Array<string>> = ['cccc', 'bbb']

export function encrypt(plain: string): string {
  let result = plain
  let i = 0

  for (const key of essence) {
    console.log(`${i++}th: ${result}`)
    result = AES.encrypt(result, key).toString()
  }
  console.log(`${i++}th: ${result}`)

  return result
}

export function decrypt(encrypted: string): string {
  const reversed = essence.slice().reverse()

  let result = encrypted
  let i = 0

  for (const key of reversed) {
    console.log(`${i++}th: ${result}`)
    result = AES.decrypt(result, key).toString(enc.Utf8)
  }
  console.log(`${i++}th: ${result}`)

  return result
}

and wrote 2 tests

decrypt ∘ encrypt = id?

  import { equal } from 'assert'
  import { encrypt, decrypt } from './password'

  equal(
    decrypt(encrypt('aaa')),
    'aaa',
  )

This is succeed. But...

encrypt ∘ decrypt = id?

  import { equal } from 'assert'
  import { encrypt, decrypt } from './password'

  const encrypted = encrypt('aaa')

  equal(
    encrypt(decrypt(encrypted)),
    encrypted,
  )

This is not succeed.

This outputs:

      at Object.encrypt (src/data/password.ts:21:13)
      0th: aaa
      1th: U2FsdGVkX1+dqc1ONOoJe0Emtg7hk3gaw2dFDDpz7i0=
      2th: U2FsdGVkX1+T4l2tnqC6DkJhJ267S44fePf2aurDJQ1dnRL2N8gdOgR+e89nafrs2CJABiPL2r8kSL0HfWks3A==

      at Object.decrypt (src/data/password.ts:50:13)
      0th: U2FsdGVkX1+T4l2tnqC6DkJhJ267S44fePf2aurDJQ1dnRL2N8gdOgR+e89nafrs2CJABiPL2r8kSL0HfWks3A==
      1th: U2FsdGVkX1+dqc1ONOoJe0Emtg7hk3gaw2dFDDpz7i0=
      2th: aaa

      at Object.encrypt (src/data/password.ts:21:13)
      0th: aaa
      1th: U2FsdGVkX19f6NW8lX7mibHUo2ehVBb+iOC2G1rDFO0=
      2th: U2FsdGVkX19rZGGnvKyakv0FHJGx9FgyXivUHkD1xVuPNG8yyiYi8jh3JF372n6diJ/xekV2L7BA2NN4zgn0qA==

This is so strange, because encrypt() returns different value for the same input.

Some ideas? please x(

Property 'sha1'

Property 'sha1' does not exist on type 'typeof import("....../node_modules/crypto-ts/crypto-ts")'.ts(2339)

Issue in decrypting the encrypted text in angular 5

var encryptedMessage = AES.encrypt('abcdefg', 'key 12345').toString();
var decryptedMessage = AES.decrypt(encryptedMessage, 'key 12345').toString();

The values I am getting are totally different from each other.
Following are the values I am getting:
encryptedMessage = U2FsdGVkX183SQr+sLeoy/un696pAkxi8F6W69cuezw=
decryptedMessage = 61626364656667

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.