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

Nodejs crypto methods #47

Open
tong opened this issue Oct 2, 2015 · 3 comments
Open

Nodejs crypto methods #47

tong opened this issue Oct 2, 2015 · 3 comments

Comments

@tong
Copy link
Contributor

tong commented Oct 2, 2015

Imho crypto methods provided by nodejs should be used instead of the haxe(js) implementation.
I guess they are faster and probably less error prone.

For haxe.crypto.Md5 this would look like:

package haxe.crypto;

import js.node.Crypto;
import haxe.io.Bytes;

class Md5 {

    public static function encode( s : String ) : String {
        var h = Crypto.createHash( "md5" );
        h.update( s );
        return h.digest( "hex" );
    }

    public static function make( b : Bytes ) : Bytes {
        var h = Crypto.createHash( "md5" );
        h.update( b.getData() );
        return Bytes.ofData( h.digest() );
    }
}

What do you think?

@eduardo-costa
Copy link
Contributor

Don't know the internals of Haxe's way.
But I think if the interface is the same we could be ok with that!

@nadako
Copy link
Member

nadako commented Nov 4, 2015

PR's welcome, but I'd like to see some comparison measurements

@nadako
Copy link
Member

nadako commented Nov 9, 2015

I think there's the same problem problem with this as described in #42

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

No branches or pull requests

3 participants