Skip to content

Instantly share code, notes, and snippets.

@cholcombe973
Created November 6, 2015 23:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cholcombe973/b0846a814be0a9e885f8 to your computer and use it in GitHub Desktop.
Save cholcombe973/b0846a814be0a9e885f8 to your computer and use it in GitHub Desktop.
extern crate crc;
use crc::{crc32, Hasher32};
fn main(){
let foo = String::from("foo bar baz");
let foo_bytes = foo.into_bytes();
println!("foo bytes: {:?}", &foo_bytes);
println!("foo bar baz: {}",crc32::checksum_castagnoli(&foo_bytes));
}
@cholcombe973
Copy link
Author

Result:

cargo run
     Running `target/debug/scratch`
foo bytes: [102, 111, 111, 32, 98, 97, 114, 32, 98, 97, 122]
foo bar baz: 1599983188

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment