Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion app/zadanie01.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
const MY_PWD_HASH = '5dca0fc4e306d92b2077ad85e7c4bd87a3e8648e';

//Twój kod
const crypto = require('crypto');
var algs = ['sha256', 'sha512', 'md5', 'rmd160'];

var pwds = [ '??TegoHasła', 'CodersLab', 'Node.js Szyfruje Pliki' , 'Zaźółć Gęślą Jaźń' , 'Moje Haslo 1@3!' , '111#$((@)n', 'Dzisiaj Szyfruje 83' ];

algs.forEach(alg => {
pwds.forEach(pwd => {
var hash= crypto.createHmac(alg, pwd)
.digest('hex');

if (MY_PWD_HASH===hash) {
console.log('algorytm: '+ alg + ', hasło: ' + pwd);
}

})

});
26 changes: 25 additions & 1 deletion app/zadanieDnia1.js
Original file line number Diff line number Diff line change
@@ -1 +1,25 @@
//Twój kod
//Twój kod
var path;
var count = 0;
const crypto = require('crypto');
const fs=require('fs');

process.argv.forEach((val, index) => {
if (count ===2) {
path = val;

}
count++;
});

fs.readFile(path , 'utf8', (err, data) => {
if (err === null){
var hash= crypto.createHmac('sha256', data)
.digest('hex');

console.log(hash);

} else {
console.log('Błąd podczas odczytu pliku!', err);
}
});