Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide hash functions in addition to HMAC functions #18

Closed
adepasquale opened this issue Aug 5, 2016 · 9 comments
Closed

Provide hash functions in addition to HMAC functions #18

adepasquale opened this issue Aug 5, 2016 · 9 comments

Comments

@adepasquale
Copy link

Hello,
any particular reason why you're using HMAC functions (which need a key) and do not offer the possibility of using a plain hash functions?

In other words, would you be interested in a pull request that offers OpenSSL::Digest in addition to OpenSSL::HMAC? 😄

@jordansissel
Copy link
Contributor

I'm open to it.

What's your proposed behavior? If a user specifies a method like SHA256 but without specifying a key we would default to using Digest instead?

@adepasquale
Copy link
Author

Yeah @jordansissel, I would do like you suggested.

Another option would be using different method names, like SHA256-digest and SHA256-hmac. This would break existing configurations though, so I don't like it too much.

@atnak
Copy link

atnak commented Oct 27, 2016

An empty key defaulting to plain old digests sounds terrific!

I've always wondered why key is required because the documentation doesn't make it clear that fingerprint is actually doing HMAC. I think this is a trap initial users currently run into, because hashes are usually associated with digests rather than HMACs. I think this confusion can be averted if key is made optional in favour of plain digests.

With the apparent deprecation of checksum, I think fingerprint should at least be able to create compatible hashes.

@adepasquale
Copy link
Author

Exactly @atnak, I've run exactly into that trap the first time I used this plugin. I had to check out the code in order to better understand the documentation.

@yuri-sergiichuk
Copy link

I do also run into same trap with key is not required.

I also agree with @atnak that changing algorithm when key smells really bad.

@jordansissel, @adepasquale IMO, as SHA-256, SHA1, etc are just plain hash functions, better algorithm naming would be to leave current names as plain hash functions and follow commonly used names for HMAC: HMAC-SHA1, HMAC-SHA-256, etc.

@adepasquale
Copy link
Author

as SHA-256, SHA1, etc are just plain hash functions, better algorithm naming would be to leave current names as plain hash functions and follow commonly used names for HMAC: HMAC-SHA1, HMAC-SHA-256, etc.

@IuriiSergiichuk I agree with you about the bettern naming, but as this will break existing configurations I think it would be better to use *-digest and *-hmac to make it more explicit.

SHA1-digest
SHA1-hmac
SHA256-digest
SHA256-hmac

@jordansissel Any more thoughts about the issue? Can I send you a pull request?

@jakelandis
Copy link
Contributor

jakelandis commented May 30, 2017

I just re-discovered this ...

Spoke briefly with @suyograo on this subject, and was about to log the issue (till I found this one).

Basically, rather then changing the configuration names, simply use HMAC if the key is present, Digest otherwise. While not as explicit, it can be implemented passively.


For all but the MURMUR3 hash algorithims (SHA1, SHA256, SHA384, SHA512, MD5), a key is required.

If not provided, the following error will occur upon startup:

Cannot register filter fingerprint plugin. The error reported is:
Key value is empty. Please fill in an encryption key

We should allow for the absense of of the key, yet still support the hashing algorithms. For example, when a key is provided, the HMAC-SHA1 will be used, and when a key is not provided, simply use SHA1. I don't believe that there is any performance difference using the keyed version or not. However, if the filter is used soley for collision free uniqueness, as opposed to as a means of cyprotgraphic signature, then a key for the hash is an unecessary configuration option.

Also, we should change the error to refrain from the wording 'encryption' key, in favor of 'cryptographic' or 'HMAC' or 'signature' key since hashing is not encryption.

@praseodym
Copy link
Contributor

Opened a PR to fix this: #37

praseodym added a commit to praseodym/logstash-filter-fingerprint that referenced this issue Jun 19, 2018
@jakelandis
Copy link
Contributor

This has been released in 3.2.0 of the plugin.

To update run the following command:

bin/logstash-plugin update logstash-filter-fingerprint

Thanks again @praseodym !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants