Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*****************************************************************************************************/
- /* FICHIER : bitcoincoin.c */
- /* OBJET : Creer une blockChain */
- /* PARAMETRES : Sans Objet */
- /* HISTORIQUE : Nicolas FERRIE 26/03/2018 Creation */
- /*****************************************************************************************************/
- #include <stdlib.h>
- #include <string.h>
- #include <stdio.h>
- #include <errno.h>
- #include <sys/param.h>
- #include <malloc.h>
- #include "sha256.c"
- #include "sha256_utils.c"
- #include "sha256_utils.h"
- #include "sha256.h"
- #include <time.h>
- typedef struct Transaction {
- char* transactionsimple;
- }s_Transaction;
- s_Transaction trans__next;
- typedef struct Block {
- int index;
- char* timestamp;
- char* prev_hash;
- int nbTrans;
- s_Transaction* liste_transaction;
- char* shaMerkleRoot;
- char* shaCurrentBlock;
- int nonce;
- struct Block *previous;
- struct Block *next;
- }Block;
- typedef struct Blockchain {
- int difficulty;
- int nbBlocs;
- Block *sentinel;
- }Blockchain;
- char* hashCode (char* Ahash){
- BYTE * str=(BYTE*)Ahash;
- static char hashRes[SHA256_BLOCK_SIZE*2 + 1];
- sha256ofString(str,hashRes);
- return hashRes;
- }
- int main(){
- srand(time(NULL));
- hashCode("J'aime les fruits et les bananes");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement