Published
Edited
Dec 7, 2021
2 stars
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

{
let c=[]
for (let i=1;i<26;i++){
c.push(CaesarCipher("yzsfs",i));
}
return c;
}
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
totalKeys = function(numPeople){
return numPeople*(numPeople-1)/2
}
Insert cell
totalKeys(1000)
Insert cell
5*totalKeys(1000000000)/60/24/365
Insert cell
Insert cell
CaesarCipher = function(plainText,key){
plainText = plainText.replaceAll(" ","")
var cipherText = ''
var alphebet = 'abcdefghijklmnopqrstuvwxyz'
var letterNumber = 0
for (var i=0; i< plainText.length ;i++){
letterNumber = alphebet.indexOf(plainText[i])
cipherText += alphebet[(letterNumber+key)%26]
}
return cipherText
}
Insert cell
Insert cell
Insert cell
Insert cell
VigenereCipher("onionisbad",[2,8,4,8])
Insert cell
VigenereCipher = function(plainText,key){
plainText = plainText.replaceAll(" ","")
var cipherText = ''
var alphebet = 'abcdefghijklmnopqrstuvwxyz'
var letterNumber = 0
for (var i=0; i< plainText.length ;i++){
letterNumber = alphebet.indexOf(plainText[i])
cipherText += alphebet[(letterNumber+key[i%key.length])%26]
}
return cipherText
}
Insert cell
VigenereCipher('happy',[1,2])
Insert cell
VigenereCipher('this is a message that I want to keep secret',[13,2,3,7])
Insert cell
CaesarCipher('letusgothenyouandiwiththeeveningspreadoutagainsttheskylikeapatientetherizeduponatable',11)
Insert cell
Insert cell
VigenereCipher("haveaniceday",[1,16,5])
Insert cell
VigenereCipher("iqafqsjsjeqd",[25,10,21])
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
factorial(11)/(factorial(4)*factorial(4)*factorial(2))
Insert cell
// recursive implimentation of factorial
function factorial(n){
if(n<2){
return 1
} else {
return n*factorial(n-1)
}
}

Insert cell
Insert cell
factorial(11)/(factorial(2)*factorial(3)*factorial(2))
Insert cell
// 11!/(2!3!2!) = 5*6...11
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
factorial(20)
Insert cell
Insert cell
Insert cell
VigenereCipher("goofball",[3,1,7])
Insert cell
md `
* jpv
* ich
* om

jiopcmvh
`
Insert cell
// https://en.wikipedia.org/wiki/Kasiski_examination
Insert cell
CaesarCipher("pcetuhdshofjewhqfxoyixuqlyborqiut",10)
Insert cell
//abcdefghijklmnopqrstuvwxyz
Insert cell
// 1.
// hellogoodday
// key = (3 6 1 8 11 9 2 5 4 10 7 12)
// ciphertext = lghoadeoldoy
//
//
// 4.
// First take the ciphertext and find the letter that occurs most often. This letter should correspond the the letter 'e' in natural language. So for example, if the letter that occurs most in the ciphertext is 'g', then we guess that the key is 2. We can then test our theory.
Insert cell
CaesarCipher("zmoderncryptographyisheavilybasedonmathematicaltheoryandcomputersciencepracticecryptographicalgorithmsare",16)
Insert cell
CaesarCipher("hello",4)
Insert cell
CaesarCipher("lipps",22)
Insert cell
factorial(12)
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
// plaintext = "hellogoodday"
// ciphertext = "-hoelo-l---"
// key
// 1. 2. 3. 4. 5. 6. 7. 8 9 10 11 12
// 2 4. 5. 8. 3 11 7. 6 10 12 9. 1
Insert cell
factorial(12)
Insert cell
Insert cell
CaesarCipher("mississippi",4)
Insert cell
CaesarCipher("mississippi",13)
Insert cell
VigenereCipher("mississippi",[4,3,5,11,7,1,22,5])
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
toAscii('anything')
Insert cell
function toAscii(str){
let code = []
for(let index = 0; index < str.length; index++){
code.push(str.charCodeAt(index))
}
return code
}
Insert cell
Insert cell
dec2bin(97)
Insert cell
function dec2bin(dec) {
return (dec >>> 0).toString(2);
}
Insert cell
Insert cell
String.fromCharCode(65, 110, 121);
Insert cell
Insert cell
Insert cell
1 && 0
Insert cell
1 ^ 0
Insert cell
1 ^ 0
Insert cell
Insert cell
Insert cell
// 1 or 0
// 1
Insert cell
(0 ^ 1) || (0 && 1)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// Convert 200 to binary
// 200/2 = 100 r 0
// 100/2 = 50 r 0
// 50/2 = 25 r 0
// 25/2 = 12 r 1
// 12/2 = 6 r 0
// 6/2 = 3 r 0
// 3/2 = 1 r 1
// 1/2 = 0 r 1
//
// 200 = 11001000
//
//
// 1x2^7+1x2^6+0x2^5+0x2^4+1x2^3+0x2^2+0x2^1+0x2^0
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
toAscii('hello')
Insert cell
dec2bin(111)
Insert cell
Insert cell
// 1. dec: 100 111 108 112 104 105 110

// 2. rat

//
Insert cell
Insert cell
Insert cell
Insert cell
(2**42)/1000/1000
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
2000*(1+.12)**(5)
Insert cell
2000*(1+.01)**(60)
Insert cell
2000*(1+.12*5)
Insert cell
Insert cell
(2**(20))*40000000000
Insert cell
r = .35
Insert cell
4*(10**10)*(1+.35)**10
Insert cell
Insert cell
Insert cell
Insert cell
'10000100101010101010101010101010101010101111100011010111'.length
Insert cell
'10101010101110101010101111010101'.length
Insert cell
Insert cell
Insert cell
3*56
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
3*(16**2)+11*(16)+2
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
FileAttachment("image.png").image()
Insert cell
14%3
Insert cell
5 + -5
Insert cell
(429)%419 == 10
Insert cell
x**55 % 720
Insert cell
x = 21
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
md`
34*x mod 5 = 4*x = 3 mod 5
`
Insert cell
y=0
Insert cell
i=0
Insert cell
(for (i=0;i<23;i++){
if ((x**4)% 23== 18){
y=i
}
})
Insert cell
y
Insert cell
Insert cell
5 = 8 mod 3
Insert cell
{
for(let i = 0; i<=23;i++){
}
}

Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Math.sqrt(2**500)
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
#### problem 1

about 300

12 = 10 + 2//
130 = 10^2 + 3 * 10

10^3 (4 digits)
Insert cell
Insert cell
p = a*10^(149) + b*10^{}
Insert cell
Insert cell
md `### 4

`
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
Eve = "Give me money asliziejfwqwoijfqwofijqwnjqweoijweoij"
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
#### Explore Chrome developer tools
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
## Some interesting topics we didn't get to
Insert cell
#### VPN

<iframe width="560" height="315" src="https://www.youtube.com/embed/CWy3x3Wux6o" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
Insert cell
#### Tor

<iframe width="560" height="315" src="https://www.youtube.com/embed/QRYzre4bf7I" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
Insert cell
### Elliptic curve cryptography
Insert cell
### Quantum Computing
Insert cell
### Eliptic curve
Insert cell
Insert cell
Insert cell
Insert cell

These are tips that I discovered after many years of learning and teaching programming. I found that students who succeed, eventually becoming programmers of some sort, practice these tips. You have to form good learning habits, otherwise you could be spending hours in front of your computer without really learning. On the other hand, if you practice these and other good habits, you get steady progress from less time.

* You **cannot learn to code by watching other people code**. You have to code for yourself.
* Importing modules is one thing but **Never cut and paste code** if you don't completely understand the code. Whenever code is unfamiliar to you, go through it line-by-line with scratch paper. Type the code in character by character.
* To learn to code you have to **get into the details**. At every point in a program's execution you should know the value, scope, and type of each variable. You will need to have a piece of paper and a writing utensil to keep track of this information.
* When you encounter a tricky topic (recursion for example). **Test your knowledge by trying to explain it to someone else**. If you cannot get your thoughts together and communicate clearly then you don't understand the topic. You should spend more time studying this topic.
* Before searching for a solution for a programming problem, **spend time struggling to figure out your own solution**. You will likely make mistakes but the time and effort you put in will help you remember your mistakes and how to avoid them.
* Programming is about taking a large problem and breaking it into smaller, easier subproblems. **Before you write any code, write out a plan of attack**.
* Tutorials and walkthroughs can be useful but you should **learn by reading the official documentation** as much as possible.
* Ask questions and make comments during class.
* As soon as you can, start on a significant **programming project**.
Insert cell
2**8
Insert cell
Insert cell
// The issue is with low complexity substitution alphebets is the sometimes characters get clumped by frequency. Example, many low frequency letters are at the end of the alphebet. This is insufficent diffusion.
Insert cell
(5**1971)
Insert cell
Insert cell
import {form} from "@mbostock/form-input"
Insert cell
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