#![feature(test)]

extern crate identicon;
extern crate openssl;
extern crate test;

use openssl::hash::{hash2, MessageDigest};
use test::Bencher;

use identicon::Identicon;

#[bench]
fn generate(x: &mut Bencher) {
    let input = "42".as_bytes();
    let md5 = MessageDigest::md5();

    x.iter(|| match hash2(md5, input) {
        Ok(bytes) => Identicon::new(&bytes).image(),
        Err(e) => panic!(e),
    });
}

#![feature(test)]

extern crate identicon;
extern crate openssl;
extern crate test;

use openssl::crypto::hash::{hash, Type};
use test::Bencher;

use identicon::Identicon;

#[bench]
fn generate(x: &mut Bencher) {
    let source = "42".to_string();
    let input = source.as_bytes();

    x.iter(|| {
        let bytes = hash(Type::MD5, input);
        Identicon::new(&bytes[..]).image();
    });
}

--- 
+++ 
@@ -4,18 +4,18 @@
 extern crate openssl;
 extern crate test;
 
-use openssl::crypto::hash::{hash, Type};
+use openssl::hash::{hash2, MessageDigest};
 use test::Bencher;
 
 use identicon::Identicon;
 
 #[bench]
 fn generate(x: &mut Bencher) {
-    let source = "42".to_string();
-    let input = source.as_bytes();
+    let input = "42".as_bytes();
+    let md5 = MessageDigest::md5();
 
-    x.iter(|| {
-        let bytes = hash(Type::MD5, input);
-        Identicon::new(&bytes[..]).image();
+    x.iter(|| match hash2(md5, input) {
+        Ok(bytes) => Identicon::new(&bytes).image(),
+        Err(e) => panic!(e),
     });
 }
Update digest usage in benchmark
