This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | def to_hex(r, g, b) | |
| [r, g, b].inject('#') do |hex, n| | |
| hex + n.to_s(16).rjust(2, '0') | |
| end | |
| end | |
| def to_ints(hex) | |
| hex.scan(/\w\w/).map(&:hex) | |
| end | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | const SHA256 = require("crypto-js/sha256"); | |
| class Block { | |
| constructor(index, timestamp, data, previousHash = '') { | |
| this.index = index; | |
| this.previousHash = previousHash; | |
| this.timestamp = timestamp; | |
| this.data = data; | |
| this.hash = this.calculateHash(); | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | const SHA256 = require("crypto-js/sha256"); | |
| class Block { | |
| constructor(index, timestamp, data, previousHash = '') { | |
| this.index = index; | |
| this.previousHash = previousHash; | |
| this.timestamp = timestamp; | |
| this.data = data; | |
| this.hash = this.calculateHash(); | |
| this.nonce = 0; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | class RSA | |
| attr_accessor :p, :q | |
| def initialize(text) | |
| @text = text | |
| end | |
| def setting_keys(p, q) | |
| @p = p | |
| @q = q |