Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw type error if data is not string #296

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

dlhandsome
Copy link

@dlhandsome dlhandsome commented May 27, 2020

The result would be the same if data is not a string when we want to get a hashcode.

For example:

const Crypto = require('crypto-js');

console.log(Crypto.MD5(1).toString()) // 487f7b22f68312d2c1bbc93b1aea445b
console.log(Crypto.MD5(2).toString()) // 487f7b22f68312d2c1bbc93b1aea445b
console.log(Crypto.MD5(3).toString()) // 487f7b22f68312d2c1bbc93b1aea445b
console.log(Crypto.MD5([32, 0, 0, 0]).toString()) // 487f7b22f68312d2c1bbc93b1aea445b

So, we should throw type error under these circumstances.

@dlhandsome
Copy link
Author

#203

@Alanscut
Copy link
Contributor

Alanscut commented Jun 9, 2020

Looks Good 👍

@majorhayes
Copy link

Wouldn't this mean that you can't pass a WordArray object in anymore? Why would you want to remove that feature?

@evanvosberg
Copy link
Member

Wouldn't this mean that you can't pass a WordArray object in anymore? Why would you want to remove that feature?

Adding type check is fine, but this should not remove the possibility to use WordArray beside String.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants