Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var hashVal = (sha256 hash value of "blockchain dev")
- // HINT: hashVal.substring(0,4) === "6d1c"
- var pattern = /((?=e{2})[0-9]{2})|([2468]{2})|([0-9]{1,3})(?=[a-d])/g
- var matches = (Get matched string array of hashVal by using pattern)
- // HINT : matches[11] === "1"
- var d = new Date()
- var dateVal = d.getYear() * (d.getMonth()+1) * 100
- // HINT : If room master forgot to update password monthly, try previous one
- var compress = function(input) {
- var cb = function(a,b){return parseInt(a)+parseInt(b)}
- return (calculate reduced value of input array by using above cb as callback function and dateVal as initialValue)
- // HINT : Array.prototype.reduce()
- }
- var password = compress(matches)
- console.log(password)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement