GithubHelp home page GithubHelp logo

cbor.github.io's Introduction

cbor.github.io

cbor.io web site

cbor.github.io's People

Contributors

adamchainz avatar adamvoss avatar albertorestifo avatar cabo avatar dwaite avatar fgasper avatar fredcadete avatar fxamacker avatar greglook avatar hildjj avatar madnight avatar manandbytes avatar mcr avatar mojotalantikite avatar nemo157 avatar paroga avatar rumpelsepp avatar saurvs avatar somerandomiosdev avatar spomky avatar svaarala avatar tshepang avatar valpackett avatar vehbisurem avatar voronoipotato avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cbor.github.io's Issues

List of companies using CBOR

Hey there! I'm interested in compiling a (small) list of companies using CBOR in production for research purposes, and Google is not helping much. Are you aware of a bunch companies using the format?

JSON->CBOR using decimal fractions?

I have long arrays of short numbers in JSON. To give a small example:

[3.1, 15.2, -80.6, 40.7]

cbor.me converts it to 37 bytes (more than in the input!):

84                     # array(4)
   FB 4008CCCCCCCCCCCD # primitive(4614162998222441677)
   FB 402E666666666666 # primitive(4624746457346762342)
   FB C054266666666666 # primitive(13858744174572365414)
   FB 404459999999999A # primitive(4630924833085561242)

I think that with decimal fractions the result would be more concise.
Is there any ready-to-use converter that automatically uses decimal fractions where it makes sense?

Show: Papers covering CBOR

Hey there!

As part of my MSc dissertation at University of Oxford, I wrote and published two papers covering the characteristics of various binary serialization formats, including CBOR and performing a space-efficiency benchmark, respectively.

Sharing them here in case anybody finds them interesting! The first paper explains how CBOR works including an annotated hexadecimal example and the second compares CBOR to various other popular serialization formats.

All the best!

discuss JSON <--> CBOR roundtripping on the website.

a major reason to adopt CBOR is as a way to represent JSON on the wire + on storage. it would be nice to very clearly see what the problems with roundtripping CBOR -> JSON -> CBOR and JSON -> CBOR -> JSON might be.

Is the root element required to be a map or an array?

In JSON, it seems to be expected that the root element is a map or an array. From reading the RFC for CBOR, I can’t find any mention of a requirement like this; ie, that a map or array is the first object which then holds other objects. Is this required and I just missed it? If not, what is the method to convert a CBOR stream without a map or array as the root object to JSON?

unclear when indefinite length could be bad

there's some subtle hints about indefinite length items not being desirable in some circumstances, but it's very unclear why.
Actually i'm unsure why i would ever use definite lengths at all.

Using indefinite-length encoding allows
an encoder to not need to marshal all the data for counting, but it
requires a decoder to allocate increasing amounts of memory while
waiting for the end of the item.
  • for unconstrained devices: why even bother. server memory is basically infinite. json works this way as well.
  • for constrained devices: knowing the array is too large earlier in the byte-stream doesn't give you more options to deal with the problem. It's still too large. Also the parsed tree's size is vaguely related to the byte-streams size, so the problem already hit you before parsing the cbor.

someone also complained on reddit (cant find the link anymore) that indefinite length items are a design mistake in cbor, but i can't figure out why. They seem fine.

spec: ambiguity with tags before `ff` breaks

Putting 9f c0 ff into http://cbor.me/ diagnostic tool says "break stop code outside indefinite length item", but that error message doesn't sound right: the 9f is an indefinite length item. The problem is that the c0 tag should precede a data item and the ff break stop code isn't a data item.

That's assuming that it's actually an error to precede ff with tags. I don't think the spec explicitly says this, other than section 2.4's "a data item can optionally be preceded by a tag". It doesn't explicitly reject the converse: tags that don't precede a data item.

Tangentially, that quote ends with "a tag" not "tags" plural, and tags are also not a data item, so according to a literal intepretation of rejecting the converse, the c1 in c1 c2 03 is invalid. On the other hand, section 2.4 goes on to say "if tag A is followed by tag B, which is followed by data item C, tag A applies to the result of applying tag B on data item C", so it sounds like tags (plural) is valid. The test-vectors don't cover this but http://cbor.me/ accepts c1 c2 03. Is it that, when spec language lawyering, c2 03 combined should be considered a data item, which is preceded by c1?

float pointer error

I use [http://cbor.me/] to verify my cbor f/w , and i found a issue about float point to cbor...

the pattern is:

BF455465737432FA3FB5E354FF

the ideal output might be:

{h'5465737432': 1.421000}

but actually output as:

{h'5465737432': 1.4210000038146973}

the float point to hex data is reference this link:
[http://gregstoll.dyndns.org/~gregstoll/floattohex/]

Please add to implementations - Revived `cbor-js` as `cbor-redux`

The implementation for browser cbor-js has been unmaintained since 2016, and all other implementations had specific dependencies on the Node.js runtime when I needed it for both browser and Deno.

I have forked cbor-js and created cbor-redux. All outstanding reported bugs on the original repo are fixed, additional tests have been written to cover code 100%, it's been rewritten it in TypeScript, and released for browser, Deno, and Node.

Plan is to maintain this and get it even with node-cbor and updates to the CBOR spec over the next couple of months.

Links to releases:
https://www.npmjs.com/package/cbor-redux
https://deno.land/x/cbor_redux
https://www.skypack.dev/npm/cbor-redux

Anchors and links within a CBOR object?

I'm not sure if this is the right place for this; please tell me where to report this if it isn't.

For one of the projects I'm working on I need to be able to serialize an object graph. This is a generic directed graph that cannot be converted into a tree (something that CBOR can easily represent natively). I know that CBOR can be extended relatively easily; are there any plans to add anchors and links to the CBOR specification? Not ones that reach outside of the single CBOR-encoded byte string, but only within it, kind of like how pointers within a single flat address space only reference objects within the same address space.

I know that I can create my own tags to do this, but if someone else is already doing something along these lines I'd rather reuse their work.

EDIT

I should have dug around more. In the IANA registry, there is reference to tags 28 & 29, which are what I was looking for. Closing this issue now.

List cyborg as a Java library

I've been working on a Java library called cyborg, at https://github.com/dwaite/cyborg.

Additional information on the library:

The initial layer 'electrode' works as a tokenizer and supports stream-based parsing and generation. I am using it in multiple related projects to read and write data with simple schemas. I wanted more flexibility than you typically would get with a library-dictated object model such as with XML or JSON Java tooling, as I thought these didn't pair well with CBOR's richer core data type or with extensible semantic tagging.

I hope to eventually have layers on top for translation to and from other formats, as well as a potential eventual object mapper to allow one to convert Java objects to and from CBOR.

I currently consider the library as in alpha, and am targeting an initial beta release (with binary builds submitted to the maven central repository) on June 10th.

C, C++ implementation

I think you published a C implementation on github, and there are also an extra couple of good one.
Whould be nice to point to them, because the lack of opensource C implementation can be a show stopper for potential adopters

New Perl CBOR modules: CBOR::Free and CBOR::PP

Hello,

I’ve written a two new Perl CBOR implementations:
https://metacpan.org/pod/CBOR::Free
https://metacpan.org/pod/CBOR::PP

CBOR::Free is in XS. It’s a bit more restricted in scope relative to CBOR::XS, but it’s got a more permissive license and (unlike CBOR::XS) supports newer Perl versions.

It’s also, in my benchmarks, faster yet than CBOR::XS. :)

CBOR::PP was my first attempt at a CBOR library. I’m releasing it in case it’s of use to someone but anticipate that CBOR::Free will be what pretty much anyone prefers to use.

Very small typo

In the paragraph titled Extensible, the first sentence should start out with "To be able >>>to<<< grow..." not "To be able grow..." as it does now. Minor point, admittedly.

CBOR implementation for Swift

I have written a library for CBOR on Swift and I have published it on my GitHub. Alongside with more than 30 different automated unit tests, it is being used practically in our project at the moment. It is working very well, and it is very easy to use for iOS projects (it is available and accessible on Cocoapods too).

Vancosys Data Security Inc.: www.vancosys.com
CBORSwift on GitHub: https://github.com/Hassaniiii/CBORSwift

Yet another one c++ implementation

Not sure if this: https://github.com/serge-klim/bobl C++ implementation would be useful to somebody. It's not exactly coder/decoder per se. It is more type based compile time encoders/decoders generator which uses CBOR as one of underlying protocols and its API is similar to recommended:

encoded = CBOR.encode(data) ➔ data = CBOR.decode(encoded) ( auto encoded = bobl::cbor::encode(data); ➔ auto data = bobl::cbor::decode(begin(encoded), end(encoded));)

JSON for Modern C++ 2.0.9 supports CBOR

The latest release of JSON for Modern C++ - a header-only C++ library that aims to promote JSON to a first-class data type in C++11 - now supports CBOR as (de)serialization format.

Examples for the usage:

It would be great if you could list us in the implementation section of your website. Furthermore, any feedback is greatly appreciated.

cbor.me off by one in comments for negative ints

For negative ints (major type 1) the diagnostic output is correct, but the comments on the right hand side look wrong. It looks like cbor.me is failing to subtract the -1 implicit in the negative int type.

For example, for hex 0x26 I see a comment of negative(6) and for 0x37 negative(23) (screenshots below).

cborbad6_stripped

cborbad23_stripped

If I'm just misunderstanding the comments then I think some clarifying message on the page would be helpful.

bad links again ...

many of the IETF and IANA (and a few other) links are missing the "https://" also, the "cbor.me" link is bad

Elixir CBOR

I've forked and updated your excbor package and was wondering if you could add it to the list of elixir implementations on cbor.io.

https://github.com/scalpel-software/cbor

Also, I think you may want to add additional test data for big integers. This area seems to be neglected in the appendix of the RFC.

Link needs an update

C, C++
A CBOR implementation in C is part of the RIOT operating system for constrained nodes 

Structure of the RIOT repository changed and link is not working.

A range of tags for private use

I'm currently designing an inter-process method invocation system, where CBOR will be the main message encoding. I need to tag references to remote objects in the messages, but it seems silly to get a tag assigned in https://docs.google.com/spreadsheets/d/1UajnKeIx_piJsAGRz5YJprvfwrBUeSVykqwG_JQL9rk/edit?usp=sharing. Since the tag for object references will only be used in my system, it seems a waste of the tag code space if I try to register my tag in the IANA registry.

In the case like mine, I think it's a common practice to reserve a range of tag values for private use. I think I might write a spec and reserve a range of tag values from the registry, but it's better to have it specified in the main CBOR spec, IMHO.

What do you think?

bad links again ...

many of the IETF and IANA (and a few other) links are missing the "https://"

Different Byte strings decodes into same UTF string, is that correct?

Hello! We at Radix are using CBOR. I just found strange behavior in encoding and decoding of this UTF string:
"radix.particles.message"

The Cbor playground cbor.me encodes that into the byte string

77
72616469782e7061727469636c65732e6d657373616765

Which also both SwiftCBOR and node-cbor do.

But Java Jacksson Cbor encodes it to:

7817
72616469782e7061727469636c65732e6d657373616765

Notice the difference, the prefix 77 versus 7817.

The interesting part is that both Cbor.me and SwiftCBOR decodes 781772616469782e7061727469636c65732e6d657373616765 into the same UTF string: "radix.particles.message".

In other words, two different byte strings decode into the same UTF string.

Is that correct?

According to the RFC 7049, the major type is 3, i.e. 0b011 followed by the length of that string, which is 23 is decimal, which results in 0b10111 in binary, and 01110111 in hex is 77.

So where does 7817 come from? And why does it correctly decode into the same UTF string?

OCaml has CBOR implementations

The OCaml programming language has a couple of notable CBOR implementations.

  • The cbor package is a minimal and lightweight implementation of just the core CBOR data structures. It encodes and decodes to and from OCaml strings.

  • The orsetto package is a serialization framework that includes streaming encoders and decoders for both JSON and CBOR.

Java implementation : libcbor

libcbor

Hi,

I have made a fully featured CBOR stream serializer/parser with some unique functionality
that makes this library particularly suitable for network processing.

https://github.com/Marlinski/libcbor/

please add this a CBOR implementation for Java.

Features

  • Encodes and decodes all examples described in RFC 7049
  • Supports 64-bit integer values
  • Reactive parsing (callback method for every decoded items)
  • Advanced parser builder
  • Conditional parsing
  • Runtime parser manipulation
  • Reusable Encoder/Parser

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.