Advertisement
Guest User

Untitled

a guest
Apr 21st, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.66 KB | None | 0 0
  1. /*****************************************************************************************************/
  2. /*  FICHIER     : bitcoincoin.c                                                                      */
  3. /*  OBJET       : Creer une blockChain                                                               */
  4. /*  PARAMETRES  : Sans Objet                                                                         */
  5. /*  HISTORIQUE  : Nicolas FERRIE 26/03/2018 Creation                                                 */
  6. /*****************************************************************************************************/
  7.  
  8. #include <stdlib.h>
  9. #include <string.h>
  10. #include <stdio.h>
  11. #include <errno.h>
  12. #include <sys/param.h>
  13. #include <malloc.h>
  14. #include "sha256.c"
  15. #include "sha256_utils.c"
  16. #include "sha256_utils.h"
  17. #include "sha256.h"
  18. #include <time.h>
  19.  
  20. typedef struct Transaction {
  21.     char* transactionsimple;
  22.  
  23.  
  24. }s_Transaction;
  25.  
  26. s_Transaction trans__next;
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36. typedef struct Block {
  37.         int index;
  38.         char* timestamp;
  39.         char* prev_hash;
  40.         int nbTrans;
  41.         s_Transaction* liste_transaction;
  42.         char* shaMerkleRoot;
  43.         char* shaCurrentBlock;
  44.         int nonce;
  45.     struct Block *previous;
  46.     struct Block *next;
  47. }Block;
  48.  
  49.  
  50. typedef struct Blockchain {
  51.         int difficulty;
  52.         int nbBlocs;
  53.     Block *sentinel;
  54.  
  55. }Blockchain;
  56. char* hashCode (char* Ahash){
  57.   BYTE * str=(BYTE*)Ahash;
  58.   static char hashRes[SHA256_BLOCK_SIZE*2 + 1];
  59.   sha256ofString(str,hashRes);
  60.   return hashRes;
  61. }
  62.  
  63.  
  64.  
  65. int main(){
  66.   srand(time(NULL));
  67.   hashCode("J'aime les fruits et les bananes");
  68.   return 0;
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement