HaxeFoundation / HaxeFoundation/hxnodejs

Nodejs crypto methods

Open
#47 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
Haxe
Stars
177
Forks
58
PR merge metrics
No merged PRs in 30d

Description

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:

``` haxe
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?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.