<commit_before>use crate::prelude::*;
use md5;

impl Uuid {
    /// Creates a [`Uuid`] using a name from a namespace, based on the MD5
    /// hash.
    ///
    /// A number of namespaces are available as constants in this crate:
    ///
    /// * [`NAMESPACE_DNS`]
    /// * [`NAMESPACE_OID`]
    /// * [`NAMESPACE_URL`]
    /// * [`NAMESPACE_X500`]
    ///
    /// Note that usage of this method requires the `v3` feature of this crate
    /// to be enabled.
    ///
    /// [`NAMESPACE_DNS`]: ../ns/const.NAMESPACE_DNS.html
    /// [`NAMESPACE_OID`]: ../ns/const.NAMESPACE_OID.html
    /// [`NAMESPACE_URL`]: ../ns/const.NAMESPACE_URL.html
    /// [`NAMESPACE_X500`]: ../ns/const.NAMESPACE_X500.html
    /// [`Uuid`]: ../struct.Uuid.html
    pub fn new_v3(namespace: &Uuid, name: &[u8]) -> Uuid {
        let mut context = md5::Context::new();

        context.consume(namespace.as_bytes());
        context.consume(name);

        let computed = context.compute();
        let bytes = computed.into();

        let mut builder =
            crate::builder::Builder::from_bytes(bytes);

        builder
            .set_variant(Variant::RFC4122)
            .set_version(Version::Md5);

        builder.build()
    }
}

#[cfg(test)]
mod tests {
    use crate::prelude::*;

    static FIXTURE: &'static [(&'static Uuid, &'static str, &'static str)] = &[
        (
            &Uuid::NAMESPACE_DNS,
            "example.org",
            "04738bdf-b25a-3829-a801-b21a1d25095b",
        ),
        (
            &Uuid::NAMESPACE_DNS,
            "rust-lang.org",
            "c6db027c-615c-3b4d-959e-1a917747ca5a",
        ),<commit_msg>run fmt<commit_after>use crate::prelude::*;
use md5;

impl Uuid {
    /// Creates a [`Uuid`] using a name from a namespace, based on the MD5
    /// hash.
    ///
    /// A number of namespaces are available as constants in this crate:
    ///
    /// * [`NAMESPACE_DNS`]
    /// * [`NAMESPACE_OID`]
    /// * [`NAMESPACE_URL`]
    /// * [`NAMESPACE_X500`]
    ///
    /// Note that usage of this method requires the `v3` feature of this crate
    /// to be enabled.
    ///
    /// [`NAMESPACE_DNS`]: ../ns/const.NAMESPACE_DNS.html
    /// [`NAMESPACE_OID`]: ../ns/const.NAMESPACE_OID.html
    /// [`NAMESPACE_URL`]: ../ns/const.NAMESPACE_URL.html
    /// [`NAMESPACE_X500`]: ../ns/const.NAMESPACE_X500.html
    /// [`Uuid`]: ../struct.Uuid.html
    pub fn new_v3(namespace: &Uuid, name: &[u8]) -> Uuid {
        let mut context = md5::Context::new();

        context.consume(namespace.as_bytes());
        context.consume(name);

        let computed = context.compute();
        let bytes = computed.into();

        let mut builder = crate::builder::Builder::from_bytes(bytes);

        builder
            .set_variant(Variant::RFC4122)
            .set_version(Version::Md5);

        builder.build()
    }
}

#[cfg(test)]
mod tests {
    use crate::prelude::*;

    static FIXTURE: &'static [(&'static Uuid, &'static str, &'static str)] = &[
        (
            &Uuid::NAMESPACE_DNS,
            "example.org",
            "04738bdf-b25a-3829-a801-b21a1d25095b",
        ),
        (
            &Uuid::NAMESPACE_DNS,
            "rust-lang.org",
            "c6db027c-615c-3b4d-959e-1a917747ca5a",
        ),
{'fraction_non_alphanumeric': 0.17383292383292384, 'fraction_numerical': 0.038083538083538086, 'mean_word_length': 1.9880733944954128, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5574874', 'n_tokens_mistral': 1198, 'n_tokens_neox': 1142, 'n_words': 217}