From e5c0d789fde40ad5046e49310fc178dba766e9f3 Mon Sep 17 00:00:00 2001 From: Henry de Valence Date: Thu, 23 Feb 2017 03:26:57 -0800 Subject: [PATCH] Add a Scalar::as_bytes() method. --- src/scalar.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/scalar.rs b/src/scalar.rs index 228294c..ed10297 100644 --- a/src/scalar.rs +++ b/src/scalar.rs @@ -165,6 +165,11 @@ impl Scalar { Scalar::reduce(&scalar_bytes) } + /// View this `Scalar` as a sequence of bytes. + pub fn as_bytes<'a>(&'a self) -> &'a [u8;32] { + &self.0 + } + /// Construct the additive identity pub fn zero() -> Self { Scalar([0u8; 32])