Skip to content

cabo/cbor-dcbor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cbor-dcbor gem

Use with the cbor gem (or with cbor-pure, which is a part of the cbor-diag gem) to add a to_dcbor method on objects. Requires to_cbor to already be mostly deterministic (as it is for the above two CBOR implementations), just adds deterministic ordering of maps for completeness.

Note that this implements deterministic encoding as in Section 4.2 of RFC 8949, with some additional rules as per draft-mcnally-deterministic-cbor.

require 'cbor-dcbor'

ex1 = {[]=> 1.0, aa: 2}

p CBOR.decode(ex1.to_cbor)
# {[]=>1.0, "aa"=>2}

p CBOR.decode(ex1.to_dcbor)
# {"aa"=>2, []=>1}

About

PoC of the McNally/Allen "dCBOR" application-level CBOR representation rules

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages