Rust

Implementing Gravatars with Rust is relatively straightforward. Below you’ll find an example of how to do so.

Example Implementation

use sha2::{Digest, Sha256};

fn main() {
    let email = String::from("EMAIL_ADDRESS");
    let trimmed_email = email.trim();
    let mut hashed_email = Sha256::new();
    hashed_email.update(trimmed_email);
    println!("https://gravatar.com/avatar/{:X}", hashed_email.finalize());
}


Last updated on: