Please add toHexString to crypto lib #2839
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
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! :)
The text was updated successfully, but these errors were encountered: