Published
Edited
Oct 22, 2019
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
decodeVigenere(hw_5_1, `WHY`);
Insert cell
decodeVigenere(hw_5_2, `KEYS`);
Insert cell
decodeVigenere(hw_5_1, testKey);
Insert cell
// HW-05 P1
{
let decoded = decodeVigenere(hw_5_1, testKey);
// decoded = hw_5_1;
return getIC(decoded) - 0.066;
return getProbDist(decoded);
let split = splitIntoBlocks(decoded, 3);
// split = split.map((block) => getIC(block));
split = split.map((block) => getProbDist(block));
return split;
}
Insert cell
testKey = decode([ 22, 7, 24 ]);
Insert cell
{
let key = '';
for (let i = 0; i < 26; i++) {
for (let j = 0; j < 26; j++) {
for (let k = 0; k < 26; k++) {
if (i*26*26+j*26+k == 1250) {key = decode([i,j,k])};
}
}
}
return key;
}
Insert cell
{
let cipher = hw_5_1;
let columns = splitIntoBlocks(cipher, 3);
// return columns;
columns = columns.map((block) => getFreqencies(block, false));
// return columns;
// From lecture 15 notes
let sums = [];
for (let d = 0; d < 26; d++) {
let p = columns[0];
let q = columns[1];
let sum = 0;
for (let i = 0; i < 26; i++) {
sum += p.get(decode([i])) * q.get(decode([i-d]));
}
sums.push(sum);
}
// return sums;
return sums.indexOf(Math.max(...sums));
}
Insert cell
decodeVigenere(hw_5_1,`WHY`);
Insert cell
getRepeats(hw_5_1);
Insert cell
friedmanBlockLength(hw_5_1);
Insert cell
encode("ALC%f-t");
Insert cell
decode( [17] )
Insert cell
decode([ encode('y')-encode('k') ])
Insert cell
encode('WHY')
Insert cell
getIC(hw_5_1);
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more