SIO Command $C7 Hash Compute - FujiNetWIFI/fujinet-firmware GitHub Wiki

This is a command for Device $70 - The FujiNet Device itself (see SIO-Commands-for-Device-ID-$70).

Hash Compute ($C7)

Description

Takes the data that was input by Hash Input, and hashes it with the selected hash algorithm. The result is put in the output buffer, so that Hash Output can be used to retrieve the output.

Supported hash types:

Type Value Notes
MD5 0 Currently not implemented
SHA1 1
SHA256 2
SHA512 3

Firmware version required: 1.1 (2023.08.22) +

Parameters

DCB Value
DDEVIC $70
DUNIT $01
DCOMND $C7
DSTATS $00
DBUF NULL
DTIMLO $03
DBYT 0
DAUX1 the hash type to compute
DAUX2 0

Examples

CC65

unsigned char hash_compute(void)                                                                                            
{                                                                                                                                    
  OS.dcb.ddevic   = 0x70;                                                                                                   
  OS.dcb.dunit    = 1;                                                                                                               
  OS.dcb.dcomnd   = 0xC7;                                                                                                            
  OS.dcb.dstats   = 0x00;                                                                                                            
  OS.dcb.dbuf     = NULL;                                                                                                            
  OS.dcb.dtimlo   = 0x03;                                                                                                  
  OS.dcb.dbyt     = 0;                                                                                                               
  OS.dcb.daux1    = 1;  // SHA1                                                                                                               
  siov();                                                                                                                            
                                                                                                                                     
  return OS.dcb.dstats; // Return SIO error or success.                                                                              
}                                    

Related Functions