Remove the crypto factories

This should also remove the dartc errors.

TBR=floitsch@google.com
BUG=

Review URL: https://codereview.chromium.org//16624003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart/pkg/crypto@23728 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/lib/crypto.dart b/lib/crypto.dart
index dad8211..78b2642 100644
--- a/lib/crypto.dart
+++ b/lib/crypto.dart
@@ -54,72 +54,6 @@
 }
 
 /**
- * SHA1 hash function implementation.
- */
-class SHA1 implements Hash {
-  factory SHA1() => new _SHA1();
-}
-
-/**
- * SHA256 hash function implementation.
- */
-class SHA256 implements Hash {
-  factory SHA256() => new _SHA256();
-}
-
-/**
- * MD5 hash function implementation.
- *
- * WARNING: MD5 has known collisions and should only be used when
- * required for backwards compatibility.
- */
-class MD5 implements Hash {
-  factory MD5() => new _MD5();
-}
-
-/**
- * Hash-based Message Authentication Code support.
- *
- * The [add] method is used to add data to the message. The [digest] and
- * [close] methods are used to extract the message authentication code.
- */
-// TODO(floitsch): make Hash implement Sink, EventSink or similar.
-class HMAC {
-  /**
-   * Create an [HMAC] object from a [Hash] and a key.
-   */
-  factory HMAC(Hash hash, List<int> key) => new _HMAC(hash, key);
-
-  /**
-   * Add a list of bytes to the message.
-   */
-  add(List<int> data);
-
-  /**
-   * Perform the actual computation and extract the message digest
-   * as a list of bytes.
-   */
-  List<int> close();
-
-  /**
-   * Extract the message digest as a list of bytes without closing [this].
-   */
-  List<int> get digest;
-
-  /**
-   * Verify that the HMAC computed for the data so far matches the
-   * given message digest.
-   *
-   * This method should be used instead of memcmp-style comparisons
-   * to avoid leaking information via timing.
-   *
-   * Throws an exception if the given digest does not have the same
-   * size as the digest computed by this HMAC instance.
-   */
-  bool verify(List<int> digest);
-}
-
-/**
  * Utility methods for working with message digests.
  */
 class CryptoUtils {
diff --git a/lib/src/hmac.dart b/lib/src/hmac.dart
index 2d07cff..59c1771 100644
--- a/lib/src/hmac.dart
+++ b/lib/src/hmac.dart
@@ -4,16 +4,32 @@
 
 part of crypto;
 
-class _HMAC implements HMAC {
+/**
+ * Hash-based Message Authentication Code support.
+ *
+ * The [add] method is used to add data to the message. The [digest] and
+ * [close] methods are used to extract the message authentication code.
+ */
+// TODO(floitsch): make Hash implement Sink, EventSink or similar.
+class HMAC {
   bool _isClosed = false;
 
-  _HMAC(Hash this._hash, List<int> this._key) : _message = [];
+  /**
+   * Create an [HMAC] object from a [Hash] and a key.
+   */
+  HMAC(Hash this._hash, List<int> this._key) : _message = [];
 
+  /**
+   * Add a list of bytes to the message.
+   */
   add(List<int> data) {
     if (_isClosed) throw new StateError("HMAC is closed");
     _message.addAll(data);
   }
 
+  /**
+   * Extract the message digest as a list of bytes without closing [this].
+   */
   List<int> get digest {
     var blockSize = _hash.blockSize;
 
@@ -58,11 +74,25 @@
     return _hash.close();
   }
 
+  /**
+   * Perform the actual computation and extract the message digest
+   * as a list of bytes.
+   */
   List<int> close() {
     _isClosed = true;
     return digest;
   }
 
+  /**
+   * Verify that the HMAC computed for the data so far matches the
+   * given message digest.
+   *
+   * This method should be used instead of memcmp-style comparisons
+   * to avoid leaking information via timing.
+   *
+   * Throws an exception if the given digest does not have the same
+   * size as the digest computed by this HMAC instance.
+   */
   bool verify(List<int> digest) {
     var computedDigest = this.digest;
     if (digest.length != computedDigest.length) {
diff --git a/lib/src/md5.dart b/lib/src/md5.dart
index 279db3d..6acf384 100644
--- a/lib/src/md5.dart
+++ b/lib/src/md5.dart
@@ -4,9 +4,14 @@
 
 part of crypto;
 
-// The MD5 hasher is used to compute an MD5 message digest.
-class _MD5 extends _HashBase implements MD5 {
-  _MD5() : super(16, 4, false) {
+/**
+ * MD5 hash function implementation.
+ *
+ * WARNING: MD5 has known collisions and should only be used when
+ * required for backwards compatibility.
+ */
+class MD5 extends _HashBase {
+  MD5() : super(16, 4, false) {
     _h[0] = 0x67452301;
     _h[1] = 0xefcdab89;
     _h[2] = 0x98badcfe;
diff --git a/lib/src/sha1.dart b/lib/src/sha1.dart
index 79a23e3..f08c987 100644
--- a/lib/src/sha1.dart
+++ b/lib/src/sha1.dart
@@ -4,10 +4,12 @@
 
 part of crypto;
 
-// The SHA1 hasher is used to compute an SHA1 message digest.
-class _SHA1 extends _HashBase implements SHA1 {
+/**
+ * SHA1 hash function implementation.
+ */
+class SHA1 extends _HashBase {
   // Construct a SHA1 hasher object.
-  _SHA1() : _w = new List(80), super(16, 5, true) {
+  SHA1() : _w = new List(80), super(16, 5, true) {
     _h[0] = 0x67452301;
     _h[1] = 0xEFCDAB89;
     _h[2] = 0x98BADCFE;
diff --git a/lib/src/sha256.dart b/lib/src/sha256.dart
index 6dd198e..f1c20e3 100644
--- a/lib/src/sha256.dart
+++ b/lib/src/sha256.dart
@@ -4,10 +4,12 @@
 
 part of crypto;
 
-// The SHA256 hasher is used to compute an SHA256 message digest.
-class _SHA256 extends _HashBase implements SHA256 {
+/**
+ * SHA256 hash function implementation.
+ */
+class SHA256 extends _HashBase {
   // Construct a SHA256 hasher object.
-  _SHA256() : _w = new List(64), super(16, 8, true) {
+  SHA256() : _w = new List(64), super(16, 8, true) {
     // Initial value of the hash parts. First 32 bits of the fractional parts
     // of the square roots of the first 8 prime numbers.
     _h[0] = 0x6a09e667;