Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rust-secp256k1
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
parity
rust-secp256k1
Commits
33368bb2
Unverified
Commit
33368bb2
authored
5 years ago
by
Demi M. Obenour
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'origin/master' into demi-upgrade-deps
parents
b0868dc1
246aefee
No related merge requests found
Pipeline
#54335
passed with stage
in 33 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/key.rs
+3
-3
3 additions, 3 deletions
src/key.rs
with
3 additions
and
3 deletions
src/key.rs
+
3
−
3
View file @
33368bb2
...
...
@@ -16,7 +16,7 @@
//! # Public and secret keys
use
arrayvec
::
ArrayVec
;
use
rand
::
Rng
;
use
rand
::
Rng
Core
;
use
super
::{
Secp256k1
,
ContextFlag
};
use
super
::
Error
::{
self
,
IncapableContext
,
InvalidPublicKey
,
InvalidSecretKey
};
...
...
@@ -64,7 +64,7 @@ pub const MINUS_ONE_KEY: SecretKey = SecretKey([0xff, 0xff, 0xff, 0xff, 0xff, 0x
#[derive(Copy,
Clone,
PartialEq,
Eq,
Debug,
Hash)]
pub
struct
PublicKey
(
ffi
::
PublicKey
);
fn
random_32_bytes
<
R
:
Rng
>
(
rng
:
&
mut
R
)
->
[
u8
;
32
]
{
fn
random_32_bytes
<
R
:
Rng
Core
>
(
rng
:
&
mut
R
)
->
[
u8
;
32
]
{
let
mut
ret
=
[
0u8
;
32
];
rng
.fill_bytes
(
&
mut
ret
);
ret
...
...
@@ -73,7 +73,7 @@ fn random_32_bytes<R: Rng>(rng: &mut R) -> [u8; 32] {
impl
SecretKey
{
/// Creates a new random secret key
#[inline]
pub
fn
new
<
R
:
Rng
>
(
secp
:
&
Secp256k1
,
rng
:
&
mut
R
)
->
SecretKey
{
pub
fn
new
<
R
:
Rng
Core
>
(
secp
:
&
Secp256k1
,
rng
:
&
mut
R
)
->
SecretKey
{
let
mut
data
=
random_32_bytes
(
rng
);
unsafe
{
while
ffi
::
secp256k1_ec_seckey_verify
(
secp
.ctx
,
data
.as_ptr
())
==
0
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment