Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thlorenz/plain-hamming
Calculate the Hamming distance between two strings using algorithm that does no input checking to be faster.
https://github.com/thlorenz/plain-hamming
Last synced: 26 days ago
JSON representation
Calculate the Hamming distance between two strings using algorithm that does no input checking to be faster.
- Host: GitHub
- URL: https://github.com/thlorenz/plain-hamming
- Owner: thlorenz
- License: mit
- Created: 2017-01-23T16:09:59.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-01-23T16:38:14.000Z (almost 8 years ago)
- Last Synced: 2024-12-05T06:34:59.548Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 2.93 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# plain-hamming [![build status](https://secure.travis-ci.org/thlorenz/plain-hamming.png)](http://travis-ci.org/thlorenz/plain-hamming)
Calculates the [Hamming distance](https://en.wikipedia.org/wiki/Hamming_distance) between two strings.
Uses very simple algorithm that does no input checking to be faster, therefore make sure that the arguments you pass in
are both strings of equal length.```js
const plainHamming = require('plain-hamming')
plainHamming('hello', 'hello') // => 0
plainHamming('hello', 'he1lo') // => 1
plainHamming('hello', 'he11o') // => 2
plainHamming('hello', 'h3llo') // => 1
plainHamming('hello', 'h3ll0') // => 2
```## Installation
npm install plain-hamming
## License
MIT