You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For now, we use object-hash to get a hash of configuration version.
We want to remove this dependency and write our own hashing function.
Details
Here is an example of the new API:
constcurrentVersion={hash: '000000000000000000000000',// Already computed unique hashentries: {A: 'value A',},};constnewVersion={// ...entries: {A: 'value A',B: 'value B',},};consthash=getHash(newVersion.entries,currentVersion.hash);// Should be a unique hash// or, if there is no precedent version (for example for the first version)consthash=getHash(newVersion.entries);
The idea is to concatenate the following values:
[PRECEDENT VERSION HASH] + [ENTRY KEY 0] + [ENTRY VALUE 0] + [ENTRY KEY 1] ...
eg: 000000000000000000000000 A value A B value B
or, for no precedent version
[ENTRY KEY 0] + [ENTRY VALUE 0] + [ENTRY KEY 1] + [ENTRY VALUE 1] ...
Then, get a unique hash of this character chain. You can use the native Node.JS crypto module to find the better way to do this.
Requirements
The code MUST be tested
The transpiled code should be compatible with Node 6 (see node.green)
The hash MUST be unique for two different strings getHash({ a: 1 }) !== getHash({ b: 2 })
The hash MUST be the same for the same string getHash({ a: 1 }) !== getHash({ a: 1 })
It is highly recommended to write the tests first and then code the function.
Feel free to ask your questions here!
The text was updated successfully, but these errors were encountered:
Rationale
For now, we use
object-hash
to get a hash of configuration version.We want to remove this dependency and write our own hashing function.
Details
Here is an example of the new API:
The idea is to concatenate the following values:
or, for no precedent version
Then, get a unique hash of this character chain. You can use the native Node.JS crypto module to find the better way to do this.
Requirements
getHash({ a: 1 }) !== getHash({ b: 2 })
getHash({ a: 1 }) !== getHash({ a: 1 })
It is highly recommended to write the tests first and then code the function.
Feel free to ask your questions here!
The text was updated successfully, but these errors were encountered: