Skip to content
This repository has been archived by the owner on Apr 6, 2022. It is now read-only.
/ hson Public archive

SHA-3 512 bit hashing checksum JSON storage

License

Notifications You must be signed in to change notification settings

rk0cc/hson

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hash check JSON storage

HSON test HSON build release

(This is an experimental repository which learning to use cgo and compile dynamic libray with GitHub Action)

HSON is JSON based data storage manager library with SHA-3 hashing as checksum for validating JSON context and compressed by GZip as a side project of will_pub's data storage solution

File extension

HSON will generate a binary data file (and yes, it the same structre of JSON) with GZip compressed, the file must be named with this extensions:

  • .hson
  • .hashjson

It returned error if a file does not obey extension naming.

API

Name Description Return value
readHSON(path *C.char) *C.Char Read HSON file context from the path Raw JSON string if read data successfully, or empty string if not
writeHSON(context, path *C.Char) C.int Write HSON context to a file
  • 0 if write data successfully
  • 1 if failed during updating context (can not generate hash or non JSON data applied)
  • 2 if failed during writing to file

Cross platform ability

Read HSON with cross platform compability is yes and no since it depends the context has indented or not. If the context is minified (which wrapping data in a single line), it higher chance will be recognized. However, it not 100% worked if indented since different OS may use different new line in code.

Note for macOS users

Please download go 1.17.x, clone this project and run make build by yourself. I have no Mac.

Good news! AMD64 based macOS is available now! (You still need to compile by yourself if using Apple Silicon)

License

WTFPL