Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
blockchain-project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
SaintDizier Corentin
blockchain-project
Commits
1247428f
Commit
1247428f
authored
1 year ago
by
corentinstd
Browse files
Options
Downloads
Patches
Plain Diff
modif wallet
parent
17e9862a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/fr/miage/Wallet.java
+19
-7
19 additions, 7 deletions
src/main/java/fr/miage/Wallet.java
with
19 additions
and
7 deletions
src/main/java/fr/miage/Wallet.java
+
19
−
7
View file @
1247428f
...
...
@@ -9,21 +9,33 @@ public class Wallet {
private
String
publicKey
;
private
String
privateKey
;
// pour la signature
private
double
solde
;
private
List
<
UTxO
>
utxos
;
public
Wallet
(
String
publicKey
,
String
privateKey
)
{
this
.
publicKey
=
publicKey
;
this
.
privateKey
=
privateKey
;
public
Wallet
(
String
privateKey
)
throws
NoSuchAlgorithmException
{
this
.
init
(
privateKey
);
}
public
void
initWallet
(
byte
[]
data
)
throws
NoSuchAlgorithmException
{
}
private
String
hashSha256
(
String
privateKey
)
throws
NoSuchAlgorithmException
{
private
void
init
(
String
privateKey
)
throws
NoSuchAlgorithmException
{
MessageDigest
md
=
MessageDigest
.
getInstance
(
"SHA-256"
);
byte
[]
hash
=
md
.
digest
(
privateKey
.
getBytes
(
StandardCharsets
.
UTF_8
));
StringBuilder
hashedByte
=
new
StringBuilder
();
for
(
byte
b
:
hash
){
hashedByte
.
append
(
String
.
format
(
"%02x"
,
b
));
}
this
.
publicKey
=
hashedByte
.
toString
();
this
.
privateKey
=
privateKey
;
this
.
solde
=
20
;
this
.
utxos
.
add
(
new
UTxO
(
this
,
null
,
solde
))
}
public
String
getPrivateKey
()
{
return
privateKey
;
}
public
String
getPublicKey
()
{
return
publicKey
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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