[Cryptography] Is ASN.1 still the thing?
watsonbladd at gmail.com
Fri Nov 17 15:36:09 EST 2017
On Fri, Nov 17, 2017 at 12:06 PM, Nico Williams <nico at cryptonector.com> wrote:
> On Fri, Nov 17, 2017 at 11:07:10AM -0800, Watson Ladd wrote:
>> On Nov 17, 2017 10:59 AM, "Nico Williams" <nico at cryptonector.com> wrote:
>> > IEEE754 issues are encoding-agnostic. This kind of thing comes up all
>> > the time in JSON tooling, in ECMAScript, in RDBMSes, and many other
>> > things besides. S-expressions wouldn't be immune. If you want floating
>> > point numbers to interop and round-trip then all implementations must
>> > use arbitrary precision floating point software implementations.
>> This is not exactly true. IEEE floats don't come with a wire format but
>> you can serialize and deserialize the fields in the float and that is
>> specified to work. Formats using other bases can work with the right high
> "specified to work" -- specification vs. reality.
>> precision print routine.
> The moment you parse into an IEEE754 representation and use that as the
> canonical form for subsequent output, you've failed to round-trip.
That's not the problem. The problem is representing IEEE745 floats and
serializing and deserializing That IEEE745 floats might not represent
every number you want i
> Serialization formats generally don't know anything about IEEE754, and
> rightly so. And not everyone uses IEEE754 for in-memory representation
> of real numbers. Numbers then might not round-trip real numbers because
> the source uses an arbitrary precision library (or unums, or...) and the
> other peer uses IEEE754.
If your serialization doesn't know about floats, it won't work with
floats. If your source and destination are using different
representations why on earth would you expect that to work?
What should be the case, is that your destination gets the closest
representable approximation to what your source wrote. But that won't
round trip: how could it?
> If you'd like some examples with JSON, go look at issues tagged ieee754
> on https://github.com/stedolan/jq .
"Man is born free, but everywhere he is in chains".
More information about the cryptography