Index: lib/src/crypto_utils.dart |
diff --git a/lib/src/crypto_utils.dart b/lib/src/crypto_utils.dart |
index 84987160b52a78bfc7b55c98255b96f718b1e752..b1b428bc74d7c2f38f11d00b071dc03ddce5456c 100644 |
--- a/lib/src/crypto_utils.dart |
+++ b/lib/src/crypto_utils.dart |
@@ -6,14 +6,10 @@ library crypto.crypto_utils; |
import 'base64.dart'; |
-/** |
- * Utility methods for working with message digests. |
- */ |
+/// Utility methods for working with message digests. |
abstract class CryptoUtils { |
- /** |
- * Convert a list of bytes (for example a message digest) into a hex |
- * string. |
- */ |
+ /// Convert a list of bytes (for example a message digest) into a hexadecimal |
+ /// string. |
static String bytesToHex(List<int> bytes) { |
var result = new StringBuffer(); |
for (var part in bytes) { |
@@ -22,37 +18,32 @@ abstract class CryptoUtils { |
return result.toString(); |
} |
- /** |
- * Converts a list of bytes into a Base 64 encoded string. |
- * |
- * The list can be any list of integers in the range 0..255, |
- * for example a message digest. |
- * |
- * If [addLineSeparator] is true, the resulting string will be |
- * broken into lines of 76 characters, separated by "\r\n". |
- * |
- * If [urlSafe] is true, the result is URL and filename safe. |
- * |
- * Based on [RFC 4648](http://tools.ietf.org/html/rfc4648) |
- * |
- */ |
+ /// Converts a list of bytes into a [Base64-encoded][rfc] string. |
+ /// |
+ /// [rfc]: https://tools.ietf.org/html/rfc4648 |
+ /// |
+ /// The list can be any list of integers from 0 to 255 inclusive, for example |
+ /// a message digest. |
+ /// |
+ /// If [addLineSeparator] is true, the resulting string will be |
+ /// broken into lines of 76 characters, separated by "\r\n". |
+ /// |
+ /// If [urlSafe] is true, the resulting string will be URL- and filename- |
+ /// safe. |
static String bytesToBase64(List<int> bytes, |
[bool urlSafe = false, bool addLineSeparator = false]) { |
return BASE64.encode(bytes, |
urlSafe: urlSafe, addLineSeparator: addLineSeparator); |
} |
- /** |
- * Converts a Base 64 encoded String into list of bytes. |
- * |
- * Decoder ignores "\r\n" sequences from input. |
- * |
- * Accepts both URL safe and unsafe Base 64 encoded strings. |
- * |
- * Throws a FormatException exception if input contains invalid characters. |
- * |
- * Based on [RFC 4648](http://tools.ietf.org/html/rfc4648) |
- */ |
+ /// Converts a [Base64-encoded][rfc] String into list of bytes. |
+ /// |
+ /// [rfc]: https://tools.ietf.org/html/rfc4648 |
+ /// |
+ /// This ignores "\r\n" sequences in [input]. It accepts both URL-safe and |
+ /// -unsafe Base 64 encoded strings. |
+ /// |
+ /// Throws a [FormatException] if [input] contains invalid characters. |
static List<int> base64StringToBytes(String input) { |
return BASE64.decode(input); |
} |