Skip to content

Commit

Permalink
feat(util): add mpi_big
Browse files Browse the repository at this point in the history
Former-commit-id: 5e03401
  • Loading branch information
dignifiedquire committed Jul 5, 2018
1 parent 23c89e3 commit 4a0ac3b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use nom::{
self, be_u16, be_u32, be_u8, eol, is_alphanumeric, AsChar, Err, IResult, InputIter,
InputLength, InputTake, Slice,
};
use openssl::bn::BigNum;
use std::convert::AsMut;
use std::ops::{Range, RangeFrom, RangeTo};

Expand Down Expand Up @@ -96,6 +97,9 @@ pub fn mpi(input: &[u8]) -> nom::IResult<&[u8], &[u8]> {
}
}

/// Parse an mpi and convert it to a `BigNum`.
named!(pub mpi_big<BigNum>, map_res!(mpi, BigNum::from_slice));

/// Convert a slice into an array
pub fn clone_into_array<A, T>(slice: &[T]) -> A
where
Expand Down

0 comments on commit 4a0ac3b

Please sign in to comment.