2014-08-12 02:26:14 +00:00
|
|
|
// Bitcoin secp256k1 bindings
|
|
|
|
// Written in 2014 by
|
|
|
|
// Dawid Ciężarkiewicz
|
|
|
|
// Andrew Poelstra
|
|
|
|
//
|
|
|
|
// To the extent possible under law, the author(s) have dedicated all
|
|
|
|
// copyright and related and neighboring rights to this software to
|
|
|
|
// the public domain worldwide. This software is distributed without
|
|
|
|
// any warranty.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the CC0 Public Domain Dedication
|
|
|
|
// along with this software.
|
|
|
|
// If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
|
|
|
|
//
|
|
|
|
|
2015-10-09 16:39:42 +00:00
|
|
|
//! # Constants
|
|
|
|
//! Constants related to the API and the underlying curve
|
2014-08-10 01:03:17 +00:00
|
|
|
|
2015-04-06 05:13:38 +00:00
|
|
|
/// The size (in bytes) of a message
|
|
|
|
pub const MESSAGE_SIZE: usize = 32;
|
2014-08-10 01:03:17 +00:00
|
|
|
|
|
|
|
/// The size (in bytes) of a secret key
|
2015-01-17 16:13:45 +00:00
|
|
|
pub const SECRET_KEY_SIZE: usize = 32;
|
2014-08-10 01:03:17 +00:00
|
|
|
|
2017-12-19 20:36:46 +00:00
|
|
|
/// The size (in bytes) of a serialized public key.
|
|
|
|
pub const PUBLIC_KEY_SIZE: usize = 33;
|
2015-07-28 16:03:10 +00:00
|
|
|
|
2017-12-19 20:36:46 +00:00
|
|
|
/// The size (in bytes) of an serialized uncompressed public key
|
2015-01-17 16:13:45 +00:00
|
|
|
pub const UNCOMPRESSED_PUBLIC_KEY_SIZE: usize = 65;
|
2014-08-10 01:03:17 +00:00
|
|
|
|
|
|
|
/// The maximum size of a signature
|
2015-01-17 16:13:45 +00:00
|
|
|
pub const MAX_SIGNATURE_SIZE: usize = 72;
|
2014-08-10 01:03:17 +00:00
|
|
|
|
|
|
|
/// The maximum size of a compact signature
|
2015-04-12 15:51:15 +00:00
|
|
|
pub const COMPACT_SIGNATURE_SIZE: usize = 64;
|
2014-08-10 01:03:17 +00:00
|
|
|
|
2014-08-28 05:49:22 +00:00
|
|
|
/// The order of the secp256k1 curve
|
2015-01-17 16:13:45 +00:00
|
|
|
pub const CURVE_ORDER: [u8; 32] = [
|
2014-08-28 05:49:22 +00:00
|
|
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
|
|
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe,
|
|
|
|
0xba, 0xae, 0xdc, 0xe6, 0xaf, 0x48, 0xa0, 0x3b,
|
|
|
|
0xbf, 0xd2, 0x5e, 0x8c, 0xd0, 0x36, 0x41, 0x41
|
|
|
|
];
|
|
|
|
|
|
|
|
/// The X coordinate of the generator
|
2015-01-17 16:13:45 +00:00
|
|
|
pub const GENERATOR_X: [u8; 32] = [
|
2014-08-28 05:49:22 +00:00
|
|
|
0x79, 0xbe, 0x66, 0x7e, 0xf9, 0xdc, 0xbb, 0xac,
|
|
|
|
0x55, 0xa0, 0x62, 0x95, 0xce, 0x87, 0x0b, 0x07,
|
|
|
|
0x02, 0x9b, 0xfc, 0xdb, 0x2d, 0xce, 0x28, 0xd9,
|
|
|
|
0x59, 0xf2, 0x81, 0x5b, 0x16, 0xf8, 0x17, 0x98
|
|
|
|
];
|
|
|
|
|
|
|
|
/// The Y coordinate of the generator
|
2015-01-17 16:13:45 +00:00
|
|
|
pub const GENERATOR_Y: [u8; 32] = [
|
2014-08-28 05:49:22 +00:00
|
|
|
0x48, 0x3a, 0xda, 0x77, 0x26, 0xa3, 0xc4, 0x65,
|
|
|
|
0x5d, 0xa4, 0xfb, 0xfc, 0x0e, 0x11, 0x08, 0xa8,
|
|
|
|
0xfd, 0x17, 0xb4, 0x48, 0xa6, 0x85, 0x54, 0x19,
|
|
|
|
0x9c, 0x47, 0xd0, 0x8f, 0xfb, 0x10, 0xd4, 0xb8
|
|
|
|
];
|
|
|
|
|
|
|
|
|