diff --git a/.DS_Store b/.DS_Store index 8078bba..78814ae 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/unit00_introduction/unit01_introduction.pptx b/unit00_introduction/unit01_introduction.pptx index b30caab..ef91ce1 100644 Binary files a/unit00_introduction/unit01_introduction.pptx and b/unit00_introduction/unit01_introduction.pptx differ diff --git a/unit01_cipher_fundamentals/.DS_Store b/unit01_cipher_fundamentals/.DS_Store index 18467d3..11e37c5 100644 Binary files a/unit01_cipher_fundamentals/.DS_Store and b/unit01_cipher_fundamentals/.DS_Store differ diff --git a/unit01_cipher_fundamentals/lecture/.DS_Store b/unit01_cipher_fundamentals/lecture/.DS_Store deleted file mode 100644 index 5008ddf..0000000 Binary files a/unit01_cipher_fundamentals/lecture/.DS_Store and /dev/null differ diff --git a/unit02_symmetric/.DS_Store b/unit02_symmetric/.DS_Store index eb5fa16..a224414 100644 Binary files a/unit02_symmetric/.DS_Store and b/unit02_symmetric/.DS_Store differ diff --git a/unit02_symmetric/lecture/.DS_Store b/unit02_symmetric/lecture/.DS_Store deleted file mode 100644 index 5008ddf..0000000 Binary files a/unit02_symmetric/lecture/.DS_Store and /dev/null differ diff --git a/unit02_symmetric/lecture/~$chapter02_secret.pptx b/unit02_symmetric/lecture/~$chapter02_secret.pptx deleted file mode 100644 index b71c76f..0000000 Binary files a/unit02_symmetric/lecture/~$chapter02_secret.pptx and /dev/null differ diff --git a/z_assessments/coursework/.DS_Store b/unit02_symmetric/src/.DS_Store similarity index 91% rename from z_assessments/coursework/.DS_Store rename to unit02_symmetric/src/.DS_Store index b105248..7fd49f8 100644 Binary files a/z_assessments/coursework/.DS_Store and b/unit02_symmetric/src/.DS_Store differ diff --git a/unit03_hashing/.DS_Store b/unit03_hashing/.DS_Store index e27738c..d090629 100644 Binary files a/unit03_hashing/.DS_Store and b/unit03_hashing/.DS_Store differ diff --git a/unit03_hashing/lecture/.DS_Store b/unit03_hashing/lecture/.DS_Store deleted file mode 100644 index 5008ddf..0000000 Binary files a/unit03_hashing/lecture/.DS_Store and /dev/null differ diff --git a/unit04_public_key/.DS_Store b/unit04_public_key/.DS_Store index c8b4f74..49d2a7e 100644 Binary files a/unit04_public_key/.DS_Store and b/unit04_public_key/.DS_Store differ diff --git a/unit04_public_key/lab/.DS_Store b/unit04_public_key/lab/.DS_Store index c27d6da..179ff64 100644 Binary files a/unit04_public_key/lab/.DS_Store and b/unit04_public_key/lab/.DS_Store differ diff --git a/unit04_public_key/lab/gpg/.DS_Store b/unit04_public_key/lab/gpg/.DS_Store deleted file mode 100644 index 5008ddf..0000000 Binary files a/unit04_public_key/lab/gpg/.DS_Store and /dev/null differ diff --git a/unit04_public_key/lecture/.DS_Store b/unit04_public_key/lecture/.DS_Store deleted file mode 100644 index 5008ddf..0000000 Binary files a/unit04_public_key/lecture/.DS_Store and /dev/null differ diff --git a/unit05_key_exchange/.DS_Store b/unit05_key_exchange/.DS_Store index 4faa39a..555ec1a 100644 Binary files a/unit05_key_exchange/.DS_Store and b/unit05_key_exchange/.DS_Store differ diff --git a/unit05_key_exchange/lecture/.DS_Store b/unit05_key_exchange/lecture/.DS_Store deleted file mode 100644 index 5008ddf..0000000 Binary files a/unit05_key_exchange/lecture/.DS_Store and /dev/null differ diff --git a/unit05_key_exchange/lecture/~$unit05_key_exchange.pptx b/unit05_key_exchange/lecture/~$unit05_key_exchange.pptx deleted file mode 100644 index b71c76f..0000000 Binary files a/unit05_key_exchange/lecture/~$unit05_key_exchange.pptx and /dev/null differ diff --git a/unit06_trust_dig_cert/.DS_Store b/unit06_trust_dig_cert/.DS_Store index 0caeee4..21c0397 100644 Binary files a/unit06_trust_dig_cert/.DS_Store and b/unit06_trust_dig_cert/.DS_Store differ diff --git a/unit06_trust_dig_cert/cer/.DS_Store b/unit06_trust_dig_cert/cer/.DS_Store deleted file mode 100644 index 5008ddf..0000000 Binary files a/unit06_trust_dig_cert/cer/.DS_Store and /dev/null differ diff --git a/unit06_trust_dig_cert/lecture/.DS_Store b/unit06_trust_dig_cert/lecture/.DS_Store deleted file mode 100644 index 5008ddf..0000000 Binary files a/unit06_trust_dig_cert/lecture/.DS_Store and /dev/null differ diff --git a/unit06_trust_dig_cert/lecture/~$unit06_digital_cert.pptx b/unit06_trust_dig_cert/lecture/~$unit06_digital_cert.pptx deleted file mode 100644 index b71c76f..0000000 Binary files a/unit06_trust_dig_cert/lecture/~$unit06_digital_cert.pptx and /dev/null differ diff --git a/unit01_cipher_fundamentals/lab/.DS_Store b/unit06a_mini_project/.DS_Store similarity index 90% rename from unit01_cipher_fundamentals/lab/.DS_Store rename to unit06a_mini_project/.DS_Store index c631bfb..427ab1e 100644 Binary files a/unit01_cipher_fundamentals/lab/.DS_Store and b/unit06a_mini_project/.DS_Store differ diff --git a/unit07_tunnelling/.DS_Store b/unit07_tunnelling/.DS_Store index 116e9da..5923027 100644 Binary files a/unit07_tunnelling/.DS_Store and b/unit07_tunnelling/.DS_Store differ diff --git a/unit07_tunnelling/lecture/.DS_Store b/unit07_tunnelling/lecture/.DS_Store deleted file mode 100644 index 5008ddf..0000000 Binary files a/unit07_tunnelling/lecture/.DS_Store and /dev/null differ diff --git a/unit08_blockchain/.DS_Store b/unit08_blockchain/.DS_Store deleted file mode 100644 index 45fb92d..0000000 Binary files a/unit08_blockchain/.DS_Store and /dev/null differ diff --git a/unit08_blockchain/lab/.DS_Store b/unit08_blockchain/lab/.DS_Store deleted file mode 100644 index e732e9a..0000000 Binary files a/unit08_blockchain/lab/.DS_Store and /dev/null differ diff --git a/unit08_blockchain/lab/geth/.DS_Store b/unit08_blockchain/lab/geth/.DS_Store deleted file mode 100644 index 5008ddf..0000000 Binary files a/unit08_blockchain/lab/geth/.DS_Store and /dev/null differ diff --git a/unit09_future/.DS_Store b/unit09_future/.DS_Store deleted file mode 100644 index 4d71197..0000000 Binary files a/unit09_future/.DS_Store and /dev/null differ diff --git a/unit09_future/lab/~$lab09.docx b/unit09_future/lab/~$lab09.docx deleted file mode 100644 index 8528d3c..0000000 Binary files a/unit09_future/lab/~$lab09.docx and /dev/null differ diff --git a/unit10_services/.DS_Store b/unit10_services/.DS_Store deleted file mode 100644 index a679f56..0000000 Binary files a/unit10_services/.DS_Store and /dev/null differ diff --git a/unit10_services/lab/~$it10_tokens.docx b/unit10_services/lab/~$it10_tokens.docx deleted file mode 100644 index 1828dc7..0000000 Binary files a/unit10_services/lab/~$it10_tokens.docx and /dev/null differ diff --git a/unit10_services/lecture/unit09_host_services2.pdf b/unit10_services/lecture/unit09_host_services2.pdf new file mode 100644 index 0000000..da26f04 Binary files /dev/null and b/unit10_services/lecture/unit09_host_services2.pdf differ diff --git a/unit10_services/lecture/~$unit09_host_services2.pptx b/unit10_services/lecture/~$unit09_host_services2.pptx deleted file mode 100644 index b71c76f..0000000 Binary files a/unit10_services/lecture/~$unit09_host_services2.pptx and /dev/null differ diff --git a/z_assessments/.DS_Store b/z_assessments/.DS_Store deleted file mode 100644 index 9be4588..0000000 Binary files a/z_assessments/.DS_Store and /dev/null differ diff --git a/z_assessments/coursework/samples/.DS_Store b/z_assessments/coursework/samples/.DS_Store deleted file mode 100644 index 5008ddf..0000000 Binary files a/z_assessments/coursework/samples/.DS_Store and /dev/null differ diff --git a/z_assessments/test01/.DS_Store b/z_assessments/test01/.DS_Store deleted file mode 100644 index ac3f012..0000000 Binary files a/z_assessments/test01/.DS_Store and /dev/null differ diff --git a/z_assessments/test01/~$20_fake_exam_questions.docx b/z_assessments/test01/~$20_fake_exam_questions.docx deleted file mode 100644 index cbaebbb..0000000 Binary files a/z_assessments/test01/~$20_fake_exam_questions.docx and /dev/null differ diff --git a/z_jupyter/.DS_Store b/z_jupyter/.DS_Store deleted file mode 100644 index 48f0d99..0000000 Binary files a/z_jupyter/.DS_Store and /dev/null differ diff --git a/z_jupyter/01_introduction.ipynb b/z_jupyter/01_introduction.ipynb new file mode 100644 index 0000000..6c4bbf4 --- /dev/null +++ b/z_jupyter/01_introduction.ipynb @@ -0,0 +1,309 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "ddb45b14", + "metadata": {}, + "source": [ + "# Lab 1: Cryptography Fundamentals" + ] + }, + { + "cell_type": "markdown", + "id": "27a217f9", + "metadata": {}, + "source": [ + "Objective: The key objective of this lab is to be introduced to some of the fundamental principles involved in cryptography, including the usage of Base-64, hexadecimal, the modulus operator some basic operators (such as AND, OR, X-OR, Rotate Right and Rotate Left), and prime numbers. This lab also involves cracking puzzles, and which have been added to get you to think about the methods involved in cipher cracking. You can undertake the additional challenges if you want to further develop your cryptography skills.\n", + "\n", + "Go to vsoc2.napier.ac.uk and find your folder. Run your Ubuntu instance demo. The virtual machine's password is napier123. Lab demo: (Note that you will be using Ubuntu, while the demo shows Kali). A demo of the lab is here." + ] + }, + { + "cell_type": "markdown", + "id": "c3d1c955", + "metadata": {}, + "source": [ + "## A.1 Is prime?\n", + "\n", + "Using: here\n", + "\n", + "Test for the following prime numbers: 91: [Yes] [No]\n", + "\n", + "421: [Yes] [No]\n", + "\n", + "1449: [Yes] [No]" + ] + }, + { + "cell_type": "markdown", + "id": "7c70d292", + "metadata": {}, + "source": [ + "## A.2 gcd\n", + "\n", + "Using: here\n", + "\n", + "Determine the GCD for the following: 88, 46:\n", + "\n", + "105, 35:" + ] + }, + { + "cell_type": "markdown", + "id": "22cfed86", + "metadata": {}, + "source": [ + "## A.3 Base-64 convertor\n", + "\n", + "Using: here\n", + "\n", + "Determine the Base 64 and Hex values for the following strings:\n", + "\n", + "Hello:\n", + "\n", + "hello:\n", + "\n", + "HELLO:" + ] + }, + { + "cell_type": "markdown", + "id": "41348372", + "metadata": {}, + "source": [ + "## A.4 Base-64 convertor\n", + "\n", + "Using: here\n", + "\n", + "Determine the following ASCII strings for these encoded formats:\n", + "\n", + "bGxveWRz\n", + "6E6170696572\n", + "01000001 01101110 01101011 01101100 01100101 00110001 00110010 00110011\n" + ] + }, + { + "cell_type": "markdown", + "id": "cb873433", + "metadata": {}, + "source": [ + "## A.5 The mod operator\n", + "\n", + "Using Python, what is the result of 53,431 (mod 453)?\n", + "\n", + "In Python, this is:\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2d9dc064", + "metadata": {}, + "outputs": [], + "source": [ + "print (53431 % 453)" + ] + }, + { + "cell_type": "markdown", + "id": "e2bf6a52", + "metadata": {}, + "source": [ + "## A.6 Bitwise operations\n", + "Using Python, what is the results of the following:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9f6d382a", + "metadata": {}, + "outputs": [], + "source": [ + "print (0x43 | 0x21)\n", + "print (0x43 & 0x21)\n", + "print (0x43 ^ 0x21)" + ] + }, + { + "cell_type": "markdown", + "id": "a7c4bcb4", + "metadata": {}, + "source": [ + "In this case, \"|\" does a bitwise OR, \"&\" does a bitwise AND, and \"^\" does a bitwise X-OR. Using a pen and paper, prove that these results are correct. Results:" + ] + }, + { + "cell_type": "markdown", + "id": "23c4d2f7", + "metadata": {}, + "source": [ + "## A.7 Hex, Oct, Char and Binary\n", + "\n", + "Using Python, what is the hex, octal, character, and binary equivalents of the value of 93:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4ca29ad0", + "metadata": {}, + "outputs": [], + "source": [ + "val1=93\n", + "print (\"Dec:\\t\",val1)\n", + "print (\"Bin:\\t\",bin(val1))\n", + "print (\"Hex:\\t\",hex(val1))\n", + "print (\"Oct:\\t\",oct(val1))\n", + "print (\"Char:\\t\",chr(val1))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3193073d", + "metadata": {}, + "outputs": [], + "source": [ + "## A.8 Node.js\n", + "\n", + "JavaScript is often used in cryptography. Using node.js, repeat A.7.\n" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "eea0739b", + "metadata": {}, + "outputs": [ + { + "ename": "NameError", + "evalue": "name 'console' is not defined", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0mval\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m93\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mconsole\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlog\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mval\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtoString\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3\u001b[0m \u001b[0mconsole\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlog\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mval\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtoString\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m16\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mconsole\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlog\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mval\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtoString\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m8\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0mconsole\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlog\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mString\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfromCharCode\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mval\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mNameError\u001b[0m: name 'console' is not defined" + ] + } + ], + "source": [ + "val=93\n", + "console.log(val.toString(2))\n", + "console.log(val.toString(16))\n", + "console.log(val.toString(8))\n", + "console.log(String.fromCharCode(val))" + ] + }, + { + "cell_type": "markdown", + "id": "f56f2f5d", + "metadata": {}, + "source": [ + "A.9 Base64\n", + "\n", + "Using Python, what is the Base-64 conversion for the string of “crypto”?\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e348a9ae", + "metadata": {}, + "outputs": [], + "source": [ + "import base64\n", + "str='crypto'\n", + "print (base64.b64encode(str.encode()))" + ] + }, + { + "cell_type": "markdown", + "id": "49065b48", + "metadata": {}, + "source": [ + "\n", + "## Base64\n", + "If we use a string of \"crypto1\", what do you observe from the Base64 conversion compared to the result in the previous question (A.9)? Observation:" + ] + }, + { + "cell_type": "markdown", + "id": "86ef2106", + "metadata": {}, + "source": [ + "## A.11 Bit shift\n", + "\n", + "Using Python, using a decimal value of 41, determine the result of a shift left by one bit, a shift left by two bits, a right shift by one bit, and a right shift by two bits:\n", + "\n", + "Web link (Bit shift): here\n", + "\n", + "Decimal form: 41\n", + "\n", + "Shift left (1):\n", + "\n", + "Shift left (2):\n", + "\n", + "Shift right(1):\n", + "\n", + "Shift right(2):\n", + "\n", + "Why would a shift left or shift right operator not be used on its own in cryptography?" + ] + }, + { + "cell_type": "markdown", + "id": "a87e860c", + "metadata": {}, + "source": [ + "## A.12 Factors\n", + "\n", + "In several cases in cryptography, we try and factorize a value into its factors. An example is 15, and which has factors of 5 and 3. Using the Python program defined in the following link, determine the factors of 432:\n", + "\n", + "Web link (Factorization): here\n", + "\n", + "Think of two extremely large values and determine their factors." + ] + }, + { + "cell_type": "markdown", + "id": "db2c5f72", + "metadata": {}, + "source": [ + "## A.13 Compression\n", + "\n", + "Another format we can use for our data is compression, and we can do the compression before or after the encryption process. One of the most popular methods is gzip compress, and which uses the LZ method to reduce the number of bits used. For this we will use node.js. Create a file named a_13.js and determine what the following Base64 conversions are when they are uncompressed (Hint: they are cities of the World):\n", + "\n", + "Web link (Compression): here\n", + "\n", + "Take a string of “abc” and compress it, and now keep building up the string with the same sequence (such as “abcabc…”). What do you observe from the length of the compression string if you use a random characters of the same length as an input:\n", + "\n", + "eJzzyc9Lyc8DAAgpAms=\n", + "eJxzSi3KycwDAAfXAl0=\n", + "eJzzSy1XiMwvygYADKUC8A==" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "base", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.3" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}