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

Please add toHexString to crypto lib #2839

Closed
sethladd opened this issue Apr 30, 2012 · 5 comments
Closed

Please add toHexString to crypto lib #2839

sethladd opened this issue Apr 30, 2012 · 5 comments
Assignees
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. type-enhancement A request for a change that isn't a bug

Comments

@sethladd
Copy link
Contributor

Now that we have crypto libs appearing (thanks!) I want to ask for toHexString to be added to the crypto library. This is functionality that almost everyone has to write when using hashes like SHA1 or SHA256.

In fact, this function is copied twice in the tests for crypto:

http://code.google.com/p/dart/source/browse/branches/bleeding_edge/dart/tests/lib/crypto/sha256_test.dart?spec=svn7145&r=7145

http://code.google.com/p/dart/source/browse/branches/bleeding_edge/dart/tests/lib/crypto/sha1_test.dart?spec=svn7145&r=7145

Here's the function:

String digestToString(List<int> digest) {
  var buf = new StringBuffer();
  for (var part in digest) {
    buf.add("${(part < 16) ? "0" : ""}${part.toRadixString(16).toLowerCase()}");
  }
  return buf.toString();
}

Please add this directly to the crypto library. Developers will thank you! :)

@madsager
Copy link
Contributor

madsager commented May 1, 2012

Set owner to @madsager.
Added Accepted label.

@madsager
Copy link
Contributor

madsager commented May 7, 2012

The crypto library now has a CryptoUtils class for utilities.

CryptoUtils.bytesToHex(List<int> bytes);


Added Fixed label.

@sethladd
Copy link
Contributor Author

sethladd commented May 7, 2012

Thanks! Curious, why didn't we use a top level function? Typing bytesToHex is much easier than CryptoUtils.bytesToHex

@madsager
Copy link
Contributor

madsager commented May 8, 2012

I thought it would be nice to group these utils together, but we could make it a top level function if people prefer.

@DartBot
Copy link

DartBot commented May 8, 2012

This comment was originally written by ladicek@gmail.com


I personally think that doing http://dartbug.com/2875 is even better :-)

@sethladd sethladd added Type-Enhancement area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. labels May 8, 2012
@kevmoo kevmoo added type-enhancement A request for a change that isn't a bug and removed type-enhancement labels Mar 1, 2016
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

4 participants