Skip to content
This repository was archived by the owner on Nov 1, 2020. It is now read-only.

Port Marvin hash code to CoreRT#3233

Merged
1 commit merged intonmirrorfrom
unknown repository
Apr 6, 2017
Merged

Port Marvin hash code to CoreRT#3233
1 commit merged intonmirrorfrom
unknown repository

Conversation

@ghost
Copy link

@ghost ghost commented Apr 6, 2017

Fix #2588

Port of SymCryptMarvin32() from marvin.cpp.

https://github.com/dotnet/coreclr/blob/master/src/vm/marvin32.cpp#L219

  • Tested on various seeds and data arrays up to 30 bytes long.
    (test data obtained by hacking CoreCLR to get test data with deterministic
    seeds.)

  • s0/s1 renamed to p0/p1 (for more consistency with algorithm description
    in patent.)

  • Verified that NUTC generates fully inlined code for Marving.ComputeHashString()
    (including reducing _rotl to rol or ror.)

  • Marvin specifies interpreting bytes in little-endian fashion - if this code
    ever runs on a big-endian machine, the result is probably not Marvin
    (though I can see how it's any less useful for the way we use it.)

  • This is not turned on by default (we don't yet have a switch to turn
    on randomized string hashing in CoreRT).

Fix #2588


Port of SymCryptMarvin32() from marvin.cpp.

https://github.com/dotnet/coreclr/blob/master/src/vm/marvin32.cpp#L219


- Tested on various seeds and data arrays up to 30 bytes long.
  (test data obtained by hacking CoreCLR to get test data with deterministic
  seeds.)

- s0/s1 renamed to p0/p1 (for more consistency with algorithm description
  in patent.)

- Verified that NUTC generates fully inlined code for Marving.ComputeHashString()
  (including reducing _rotl to rol or ror.)

- Marvin specifies interpreting bytes in little-endian fashion - if this code
  ever runs on a big-endian machine, the result is probably not Marvin
  (though I can see how it's any less useful for the way we use it.)

- This is not turned on by default (we don't yet have a switch to turn
  on randomized string hashing in CoreRT).
@ghost ghost merged commit 312865e into dotnet:nmirror Apr 6, 2017

default:
Debug.Fail("Should not get here.");
throw new InvalidOperationException();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@atsushikan Debug.Fail should be sufficient here. I do not think we should be adding unreachable throws.

@ghost ghost deleted the marvin branch April 7, 2017 14:15
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants