Git Product home page Git Product logo

Comments (6)

aeden avatar aeden commented on June 16, 2024

The rdata looks like this:

{dns_rrdata_sshfp,1,1,<<"8544BD5B4902151F80391563A6511FD864489763">>}

from dns_erlang.

andrewtj avatar andrewtj commented on June 16, 2024

The fingerprint goes on the wire as is so if you provide it in it's raw form (<<133,68,189,91,73,2,21,31,128,57,21,99,166,81,31,216,100,72,151,99>>) you should get back the expected hex.

The documentation could be improved here but maybe the representation should be changed as well. What do you think?

from dns_erlang.

aeden avatar aeden commented on June 16, 2024

If I store the fingerprint in its bitstring format at reast, what is the proper way to covert it to a raw binary form?

from dns_erlang.

andrewtj avatar andrewtj commented on June 16, 2024

For my own use I'd vendor mochihex and adapt to_bin/1 to accept a binary (and handle bad input if need be). erlang:list_to_integer/2 in a comprehension or similar is also an option, eg: << <<(erlang:list_to_integer([C],16)):4>> || <<C>> <= HexBin >>.

from dns_erlang.

aeden avatar aeden commented on June 16, 2024

Turns out you have a hex_to_bin function in your library, so I've just cargo-culted that for now. :-)

FWIW, I think I may come back and revisit this in the future with a PR. The representation at rest should probably be a hex string as defined in http://tools.ietf.org/html/rfc4255#section-3.2 and thus the encoder should probably handle the conversion rather than pass it as is.

from dns_erlang.

andrewtj avatar andrewtj commented on June 16, 2024

Turns out you have a hex_to_bin function in your library, so I've just cargo-culted that for now. :-)

hah, I'm getting out of touch with my own code.

FWIW, I think I may come back and revisit this in the future with a PR. The representation at rest should probably be a hex string as defined in http://tools.ietf.org/html/rfc4255#section-3.2 and thus the encoder should probably handle the conversion rather than pass it as is.

I think the representation is an issue largely because there is no converters to and from master file format. Maybe adding the following would be the way to go:

  • dns:parse_rrdata/3 - takes class, type and a binary or string. Returns {ok, Term, Leftover} or {error, Term}.
  • dns:rrdata_to_string/1 - takes an RR data record and calls dns:rrdata_to_string/3
  • dns:rrdata_to_string/3 - takes class, type and a binary or RR data record and returns a binary string.

from dns_erlang.

Related Issues (7)

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.