FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
bitcoin-php/examples/signedmessage.create.php at main · ProtonMail/bitcoin-php · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
ProtonMail
/
bitcoin-php
Public
forked from
Bit-Wasp/bitcoin-php
Notifications
You must be signed in to change notification settings
Fork
23
Star
32
Code
Issues
3
Pull requests
1
Actions
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
bitcoin-php
/
examples
/
signedmessage.create.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
21 lines (16 loc) · 719 Bytes
Breadcrumbs
bitcoin-php
/
examples
/
signedmessage.create.php
Copy path
File metadata and controls
21 lines (16 loc) · 719 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
require
__DIR__
.
"
/../vendor/autoload.php
"
;
use
BitWasp
\
Bitcoin
\
Address
\
PayToPubKeyHashAddress
;
use
BitWasp
\
Bitcoin
\
Bitcoin
;
use
BitWasp
\
Bitcoin
\
Crypto
\
Random
\
Random
;
use
BitWasp
\
Bitcoin
\
Key
\
Factory
\
PrivateKeyFactory
;
use
BitWasp
\
Bitcoin
\
MessageSigner
\
MessageSigner
;
$
ec
= Bitcoin::
getEcAdapter
();
$
random
=
new
Random
();
$
privKeyFactory
=
new
PrivateKeyFactory
(
$
ec
);
$
privateKey
=
$
privKeyFactory
->
generateCompressed
(
$
random
);
$
message
=
'
hi
'
;
$
signer
=
new
MessageSigner
(
$
ec
);
$
signed
=
$
signer
->
sign
(
$
message
,
$
privateKey
);
$
address
=
new
PayToPubKeyHashAddress
(
$
privateKey
->
getPublicKey
()->
getPubKeyHash
());
echo
sprintf
(
"
Signed by %s
\n
%s
\n"
,
$
address
->
getAddress
(),
$
signed
->
getBuffer
()->
getBinary
());
Back
|
FazBrowse Home
|
New Git URL