Wiki Home >> SIO-Command-$C7-Hash-Compute

SIO-Command-$C7-Hash-Compute


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:

TypeValueNotes
MD50Currently not implemented
SHA11
SHA2562
SHA5123

Firmware version required: 1.1 (2023.08.22) +

Parameters

DCBValue
DDEVIC$70
DUNIT$01
DCOMND$C7
DSTATS$00
DBUFNULL
DTIMLO$03
DBYT0
DAUX1the hash type to compute
DAUX20

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.                                                                              
}                                    

Wiki content is mirrored from the FujiNet Github Wiki