<commit_before>//! `crypto_scalarmult_curve25519` specified in
//! [Cryptography in NaCl](http://nacl.cr.yp.to/valid.html), Sections 2, 3, and 4.
//! This function is conjectured to be strong. For background see Bernstein,
//! "Curve25519: new Diffie-Hellman speed records," Lecture Notes in Computer
//! Science 3958 (2006), 207–228, http://cr.yp.to/papers.html#curve25519.
use ffi;

pub const BYTES: usize = ffi::crypto_scalarmult_curve25519_BYTES;
pub const SCALARBYTES: usize = ffi::crypto_scalarmult_curve25519_SCALARBYTES;

/// `Scalar` value (integer in byte representation)
#[derive(Copy)]
pub struct Scalar(pub [u8; SCALARBYTES]);

newtype_drop!(Scalar);
newtype_clone!(Scalar);
newtype_impl!(Scalar, SCALARBYTES);

/// `GroupElement`
#[derive(Copy)]
pub struct GroupElement(pub [u8; BYTES]);

newtype_clone!(GroupElement);
newtype_impl!(GroupElement, BYTES);

/// `scalarmult()` multiplies a group element `p`
/// by an integer `n`. It returns the resulting group element
/// `q`.
pub fn scalarmult(&Scalar(ref n): &Scalar,
                  &GroupElement(ref p): &GroupElement) -> GroupElement {
    let mut q = [0; BYTES];
    unsafe {
        ffi::crypto_scalarmult_curve25519(&mut q, n, p);
    }
    GroupElement(q)
}
<commit_msg>Remove derived Copy for private key<commit_after>//! `crypto_scalarmult_curve25519` specified in
//! [Cryptography in NaCl](http://nacl.cr.yp.to/valid.html), Sections 2, 3, and 4.
//! This function is conjectured to be strong. For background see Bernstein,
//! "Curve25519: new Diffie-Hellman speed records," Lecture Notes in Computer
//! Science 3958 (2006), 207–228, http://cr.yp.to/papers.html#curve25519.
use ffi;

pub const BYTES: usize = ffi::crypto_scalarmult_curve25519_BYTES;
pub const SCALARBYTES: usize = ffi::crypto_scalarmult_curve25519_SCALARBYTES;

/// `Scalar` value (integer in byte representation)
pub struct Scalar(pub [u8; SCALARBYTES]);

newtype_drop!(Scalar);
newtype_clone!(Scalar);
newtype_impl!(Scalar, SCALARBYTES);

/// `GroupElement`
#[derive(Copy)]
pub struct GroupElement(pub [u8; BYTES]);

newtype_clone!(GroupElement);
newtype_impl!(GroupElement, BYTES);

/// `scalarmult()` multiplies a group element `p`
/// by an integer `n`. It returns the resulting group element
/// `q`.
pub fn scalarmult(&Scalar(ref n): &Scalar,
                  &GroupElement(ref p): &GroupElement) -> GroupElement {
    let mut q = [0; BYTES];
    unsafe {
        ffi::crypto_scalarmult_curve25519(&mut q, n, p);
    }
    GroupElement(q)
}

{'fraction_non_alphanumeric': 0.14142628205128205, 'fraction_numerical': 0.04006410256410257, 'mean_word_length': 4.5612472160356345, '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': '4920741', 'n_tokens_mistral': 928, 'n_tokens_neox': 833, 'n_words': 228}