https://github.com/k4m4/ripemd-regex
Regular expression for matching RIPEMD hashes in strings.
https://github.com/k4m4/ripemd-regex
hash matcher regex-match ripemd
Last synced: 8 months ago
JSON representation
Regular expression for matching RIPEMD hashes in strings.
- Host: GitHub
- URL: https://github.com/k4m4/ripemd-regex
- Owner: k4m4
- License: mit
- Created: 2018-04-11T18:00:43.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T16:14:38.000Z (almost 3 years ago)
- Last Synced: 2025-04-25T22:20:16.620Z (8 months ago)
- Topics: hash, matcher, regex-match, ripemd
- Language: JavaScript
- Size: 553 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 7
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# ripemd-regex [](https://travis-ci.org/k4m4/ripemd-regex) [](https://github.com/xojs/xo)
> Regular expression for matching RIPEMD hashes in strings.
## Install
```
~ ❯❯❯ npm install ripemd-regex
```
## Usage
```js
const ripemdRegex = require('ripemd-regex');
ripemdRegex().test('nodejsrocks 744fdac358014a96aedd7e87150c5a5e04a13001');
//=> true
ripemdRegex({exact: true}).test('nodejsrocks 744fdac358014a96aedd7e87150c5a5e04a13001 foo');
//=> false
ripemdRegex({exact: true}).test('744fdac358014a96aedd7e87150c5a5e04a13001');
//=> true
ripemdRegex.version(128, {exact: true}).test('3edc724c455361be0a366c838e7d2434');
//=> true
ripemdRegex.version(320, {exact: true}).test('744fdac358014a96aedd7e87150c5a5e04a13001');
//=> false
'nodejsrocks 744fdac358014a96aedd7e87150c5a5e04a13001 rainbow f4971074a8da200c122c04bc4e0fa96066913d6f38d3397eb61a7341078cd4841386e159993826af'.match(ripemdRegex());
//=> ['744fdac358014a96aedd7e87150c5a5e04a13001','f4971074a8da200c122c04bc4e0fa96066913d6f38d3397eb61a7341078cd4841386e159993826af']
```
## API
### ripemdRegex([options])
Returns a regex for matching RIPEMD hashes.
### ripemdRegex.version([version], [options])
Returns a regex for matching specific RIPEMD version hashes.
#### version
Type: `integer`
Supported Versions: `128`, `160`, `256`, `320`
Match a specific version of RIPEMD.
#### options.exact
Type: `boolean`
Default: `false` *(Matches any RIPEMD hash in a string)*
Only match an exact string. Useful with `RegExp#test()` to check if a string is a RIPEMD hash.
## License
MIT © [Nikolaos Kamarinakis](https://nikolaskama.me)