invio / invio.hashing Goto Github PK
View Code? Open in Web Editor NEWUtilities for generating hashes and hashcodes
License: MIT License
Utilities for generating hashes and hashcodes
License: MIT License
Background
As part of our migration to v1.0.4 of the .NET SDK, I set the DebugType
to full
and updated the CI scripts to explicitly reference XML-based *.csproj
files due to the removal of global.json
and project.json
. The DebugType
really should be portable
for .NET Core when we pack the code (though it needs to be full
for when we run opencover on it), and we should add a *.sln
to manage our *.csproj
files.
Task
Invio.Hashing.sln
solution at the root of the repository that references the source and test projects.Invio.Hashing.Tests.csproj
such that <IsPackable>false</IsPackable>
is specified.set-debug-type.ps1
, but with it updating the DebugType
via the XML-based Invio.Hashing.csproj
instead of JSON-based project.json
.If there are a list of values that you are generating a hash code for, you may want to calculate the hash code of those values using a specific IEqualityComparer
implementation rather than use the object's default GetHashCode()
implementation.
For example, you may want to use a case-insensitive string comparison for objects of type string, but the normal hash code for all other objects.
Our open source libraries are currently fractured between two versions of the SDK:
v1.0.1 and v1.0.0-preview2-003121.
Let's get these standardized on the latest version supported by our CI tools (presumably v1.0.4).
Often I find myself in a situation where I have a list of objects that may contain strings. If there is a string, I want to do a case-insensitive equality/hash code comparison for each string found. Otherwise, use the default equals/hash code generation and comparison. I think this could best be solved by an IfStringComparer
implementation that accepts objects instead of strings, and uses a predefined string comparison syntax for each string found, and the normal GetHashCode()
implementation on all other objects (and a predefined constant for null - including null strings).
If we want to hash a list and maintain order, we need to implement our own hashing algorithm every time. If we want to hash a set and ignore order, we need to implement our own hashing algorithm every time.
I just wrote a bug in another repository because I incorrectly implemented my own hashing algorithm that we could solve once with a generic solution here. Let's do that instead.
NOTE: I don't think we need to update the main From
implementation to do this by default for objects it can coerce as IEnumerable<T>
, IList<T>
, ISet<T>
, et cetera. This is because I do not want to slow down the implementation with branches. I also believe it would make the hashing implementation too opinionated on what to do with a given IEnumerable (specifically: whether or not to respect order).
Travis CI has not yet been updated to use .NET Core v1.1. Code coverage and deployment is performed via appveyor, so it is not a blocking issue. However, we will not be testing to make sure the library works on Linux / Mac OS X with Mono or .NET Core.
The underlying issue from Travis CI is here.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.