md5-node-cg-lib
v0.0.10
Published
Library to create MD5 ids
Downloads
633
Maintainers
Readme
md5-node-cg-lib
The library can be downloaded from the following url: https://github.com/CloudGenUser/md5-node-cg-lib.git The downloaded must be Imported to the Project that is intended to be used
1. Introduction
This library allows generating an MD5 ID that can be used to identify and ensure if two objects are the same. With this validation the user can be sure of the integrity of the information that flows.
2. Library usage
The library can be installed from npm page with the next:
npm install md5-node-cg-lib, npm i md5-node-cg-lib or yarn install md5-node-cg-lib
2.1 Library Methods
Method getMd5ID
This method creates the "crypto" module that provides cryptographic functionality that includes a set of wrappers for OpenSSL hashing, HMAC, recording, decryption, signing, and verification functions. The algorithm depends on the available algorithms supported by the version of OpenSSL on the platform. Compute the digest of all passed data to be encrypted (using the hash.update() method)
3. Example
- VALIDATE OBJECTS
Validate the objects are correct
- GET LOCATION OF OBJECT
Get the path of Object
- RUN THE APP MD5
Run the app in development IDE.
- VALIDATE THE RUN IN THE LOG Validates in the log if the object was transformed through a message in the console where it shows the encryption of the String.
const getMd5ID = (content) => {
try {
return crypto.createHash('md5').update(content).digest("hex");
} catch (error) {
log.error(`Error Creating MD5 id: ${error}`);
throw Error(error);
}
}
The Result is:
Result MD5 id: d501194c987486789bb01b50dc1a0adb