SlideShare a Scribd company logo
1 of 25
For the beginners, by a beginner
 Security Enthusiast
 Broke lock of my own bag.
 Start many things, finish nothing (mostly)
 Threat Researcher @ Symantec
 B&B
 Talking at badboy16a@gmail.com
 Broadcasting @_badbot
Functionality
Systems
 Encoding
 Encryption
 Obfuscation
 Cryptography
 Cryptanalysis
 Steganography
 Transposition
 scytale
 Substitution
 Caesar cipher
 Enigma
 Shannon’s law of secrecy
 PGP
 Messages is split in to fixed size blocks.
Block
Encryption
 Electronic CodeBook (ECB)
 Cipher Block Chaining (CBC)
 Cipher FeedBack(CFB)
 Output Feedback(OFB)
 Counter (CTR)
 Galois Counter Mode (GCM)
 Required to align data to Block length.
 Bit Padding
 Byte Padding
 Zero Padding
 ANSIx.923
 ISO-10126
 PKCS#7
 ISO/IEC 7816-4
 One way function.
 Arbitrary length input, fixed length output.
 Examples:
 CRC(16/32)
 MD(4/5)
 SHA(1/2/3/4)
 Integers
 Prime
 Co-prime
 Modulus
 Congruenc
e
 Group
 Modulus (M)
 Operation
 Identity
 Inverse
 Generator
 Ring
 Order (M-1)
iff M is
prime.
 Diffie-Hellman Key Exchange
 Alice and Bob agree to use a
modulus p = 23 and
generator g = 5.
 Alice chooses a secret
integer a = 6, then sends
Bob A = ga mod p
 A = 56 mod 23 = 8
 Bob chooses a secret
integer b = 15, then sends
Alice B = gb mod p
 B = 515 mod 23 = 19
 Alice computes s = Ba mod p
 s = 196 mod 23 = 2
 Bob computes s = Ab mod p
 s = 815 mod 23 = 2
 Alice and Bob now share a secret
(the number 2).
 Based on intractability principle
 Multiplying two large integers is easy
 Finding prime factors of large integers is an intractable problem.
 Computations are performed in “Group” modulo M.
 M being a very large prime.
 2 keys are generated simultaneously.
 Inverse of each other (modulo M).
 One encrypts (Public Key)
 Other decrypts (Private Key)
Encryption (P=5)
C = Pe
mod n 53 % 33 = 125 % 3 = 26
Decryption
P = Cd mod n 267 % 33 = 8031810176 % 33 = 5 OR
267 % 33 = 26 (3+3+1) % 33 = (263%33)* (263%33)* (26%33) = 5
Key Generation
Select 2 primes: p,q p = 11, q = 3
Calculate: n = p*q n = 33
Calculate: Φ(n) = (p-1)*(q-1) Φ(n) = 20
Choose e : gcd(e, Φ(n)) = 1, (e,n) is public key e = 3; Kpub = (3,33)
Find d : e*d = 1 mod Φ(n), (d,n) is private key d = 7, Kpriv = (7,33)
Basics of Cryptography
Basics of Cryptography
Basics of Cryptography
Basics of Cryptography
Basics of Cryptography

More Related Content

Viewers also liked (6)

Nmap and metasploitable
Nmap and metasploitableNmap and metasploitable
Nmap and metasploitable
 
A Strategic Path from Secure Code Reviews to Threat Modeling (101)
A Strategic Path from Secure Code Reviews to Threat Modeling (101)A Strategic Path from Secure Code Reviews to Threat Modeling (101)
A Strategic Path from Secure Code Reviews to Threat Modeling (101)
 
Bit squatting
Bit squattingBit squatting
Bit squatting
 
Networking basics by rahul at Null Mumbai
Networking basics by rahul at Null MumbaiNetworking basics by rahul at Null Mumbai
Networking basics by rahul at Null Mumbai
 
Yet another talk on bug bounty
Yet another talk on bug bountyYet another talk on bug bounty
Yet another talk on bug bounty
 
Metasploit framwork
Metasploit framworkMetasploit framwork
Metasploit framwork
 

Similar to Basics of Cryptography

HW 5-RSAascii2str.mfunction str = ascii2str(ascii) .docx
HW 5-RSAascii2str.mfunction str = ascii2str(ascii)        .docxHW 5-RSAascii2str.mfunction str = ascii2str(ascii)        .docx
HW 5-RSAascii2str.mfunction str = ascii2str(ascii) .docx
wellesleyterresa
 

Similar to Basics of Cryptography (20)

Detailed cryptographic analysis of contact tracing protocols
Detailed cryptographic analysis of contact tracing protocolsDetailed cryptographic analysis of contact tracing protocols
Detailed cryptographic analysis of contact tracing protocols
 
crypto1.ppt
crypto1.pptcrypto1.ppt
crypto1.ppt
 
needed.ppt
needed.pptneeded.ppt
needed.ppt
 
introduction to cryptography (basics of it)
introduction to cryptography (basics of it)introduction to cryptography (basics of it)
introduction to cryptography (basics of it)
 
crypto.ppt
crypto.pptcrypto.ppt
crypto.ppt
 
Paillier Cryptosystem
Paillier CryptosystemPaillier Cryptosystem
Paillier Cryptosystem
 
HW 5-RSAascii2str.mfunction str = ascii2str(ascii) .docx
HW 5-RSAascii2str.mfunction str = ascii2str(ascii)        .docxHW 5-RSAascii2str.mfunction str = ascii2str(ascii)        .docx
HW 5-RSAascii2str.mfunction str = ascii2str(ascii) .docx
 
introduction to cryptography
introduction to cryptographyintroduction to cryptography
introduction to cryptography
 
Al-Gamal-W6(al gamal)-d1-d2
Al-Gamal-W6(al gamal)-d1-d2Al-Gamal-W6(al gamal)-d1-d2
Al-Gamal-W6(al gamal)-d1-d2
 
Digital signature
Digital signatureDigital signature
Digital signature
 
Information and data security other public key cryptosystems
Information and data security other public key cryptosystemsInformation and data security other public key cryptosystems
Information and data security other public key cryptosystems
 
Public-Key Cryptography.pdfWrite the result of the following operation with t...
Public-Key Cryptography.pdfWrite the result of the following operation with t...Public-Key Cryptography.pdfWrite the result of the following operation with t...
Public-Key Cryptography.pdfWrite the result of the following operation with t...
 
Cryptography 202
Cryptography 202Cryptography 202
Cryptography 202
 
Jaimin chp-8 - network security-new -use this - 2011 batch
Jaimin   chp-8 - network security-new -use this -  2011 batchJaimin   chp-8 - network security-new -use this -  2011 batch
Jaimin chp-8 - network security-new -use this - 2011 batch
 
Elliptic curvecryptography Shane Almeida Saqib Awan Dan Palacio
Elliptic curvecryptography Shane Almeida Saqib Awan Dan PalacioElliptic curvecryptography Shane Almeida Saqib Awan Dan Palacio
Elliptic curvecryptography Shane Almeida Saqib Awan Dan Palacio
 
cp467_12_lecture14_image compression1.pdf
cp467_12_lecture14_image compression1.pdfcp467_12_lecture14_image compression1.pdf
cp467_12_lecture14_image compression1.pdf
 
Reed solomon code
Reed solomon codeReed solomon code
Reed solomon code
 
6.hash mac
6.hash mac6.hash mac
6.hash mac
 
GCC
GCCGCC
GCC
 
Blockchain Technology - Week 6 - Role of Cryptography in Blockchain
Blockchain Technology - Week 6 - Role of Cryptography in BlockchainBlockchain Technology - Week 6 - Role of Cryptography in Blockchain
Blockchain Technology - Week 6 - Role of Cryptography in Blockchain
 

More from Sunil Kumar (7)

3Es of Ransomware
3Es of Ransomware3Es of Ransomware
3Es of Ransomware
 
Http2 Security Perspective
Http2 Security PerspectiveHttp2 Security Perspective
Http2 Security Perspective
 
Memory forensics
Memory forensicsMemory forensics
Memory forensics
 
n|u Dharamsala Humla : Memory Forensic by Tenzin Chokden
n|u Dharamsala Humla : Memory Forensic by Tenzin Chokdenn|u Dharamsala Humla : Memory Forensic by Tenzin Chokden
n|u Dharamsala Humla : Memory Forensic by Tenzin Chokden
 
Jsonp null-meet-02-2015
Jsonp null-meet-02-2015Jsonp null-meet-02-2015
Jsonp null-meet-02-2015
 
Dt5 varenni win_pcapdosdonts
Dt5 varenni win_pcapdosdontsDt5 varenni win_pcapdosdonts
Dt5 varenni win_pcapdosdonts
 
Nullcon 2011- Behaviour Analysis with DBI
Nullcon 2011- Behaviour Analysis with DBINullcon 2011- Behaviour Analysis with DBI
Nullcon 2011- Behaviour Analysis with DBI
 

Recently uploaded

%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 

Recently uploaded (20)

%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 

Basics of Cryptography

  • 1. For the beginners, by a beginner
  • 2.  Security Enthusiast  Broke lock of my own bag.  Start many things, finish nothing (mostly)  Threat Researcher @ Symantec  B&B  Talking at badboy16a@gmail.com  Broadcasting @_badbot
  • 4.  Encoding  Encryption  Obfuscation  Cryptography  Cryptanalysis  Steganography
  • 5.  Transposition  scytale  Substitution  Caesar cipher  Enigma  Shannon’s law of secrecy  PGP
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.  Messages is split in to fixed size blocks.
  • 14.  Electronic CodeBook (ECB)  Cipher Block Chaining (CBC)  Cipher FeedBack(CFB)  Output Feedback(OFB)  Counter (CTR)  Galois Counter Mode (GCM)
  • 15.  Required to align data to Block length.  Bit Padding  Byte Padding  Zero Padding  ANSIx.923  ISO-10126  PKCS#7  ISO/IEC 7816-4
  • 16.  One way function.  Arbitrary length input, fixed length output.  Examples:  CRC(16/32)  MD(4/5)  SHA(1/2/3/4)
  • 17.  Integers  Prime  Co-prime  Modulus  Congruenc e  Group  Modulus (M)  Operation  Identity  Inverse  Generator  Ring  Order (M-1) iff M is prime.
  • 18.  Diffie-Hellman Key Exchange  Alice and Bob agree to use a modulus p = 23 and generator g = 5.  Alice chooses a secret integer a = 6, then sends Bob A = ga mod p  A = 56 mod 23 = 8  Bob chooses a secret integer b = 15, then sends Alice B = gb mod p  B = 515 mod 23 = 19  Alice computes s = Ba mod p  s = 196 mod 23 = 2  Bob computes s = Ab mod p  s = 815 mod 23 = 2  Alice and Bob now share a secret (the number 2).
  • 19.  Based on intractability principle  Multiplying two large integers is easy  Finding prime factors of large integers is an intractable problem.  Computations are performed in “Group” modulo M.  M being a very large prime.  2 keys are generated simultaneously.  Inverse of each other (modulo M).  One encrypts (Public Key)  Other decrypts (Private Key)
  • 20. Encryption (P=5) C = Pe mod n 53 % 33 = 125 % 3 = 26 Decryption P = Cd mod n 267 % 33 = 8031810176 % 33 = 5 OR 267 % 33 = 26 (3+3+1) % 33 = (263%33)* (263%33)* (26%33) = 5 Key Generation Select 2 primes: p,q p = 11, q = 3 Calculate: n = p*q n = 33 Calculate: Φ(n) = (p-1)*(q-1) Φ(n) = 20 Choose e : gcd(e, Φ(n)) = 1, (e,n) is public key e = 3; Kpub = (3,33) Find d : e*d = 1 mod Φ(n), (d,n) is private key d = 7, Kpriv = (7,33)

Editor's Notes

  1. PGP Later
  2. https://www.digicert.com/images/iot/IoTSecuritySolutionGraphic_400x400.png
  3. DES: by IBM, Lucifer, NSA? Why not 2DES? Meet-in-the-middle
  4. Symmetric key must be shared before use.
  5. Encrypts one bit/byte. Perfect: One Time Pad
  6. Linear Feedback Shift Register Designed to be implemented in H/W (A5/1), CSS Initial State, Key, Tap Points
  7. DES Block size: 64 bits, Keysize: 56b (+8b parity) AES Block Size: 64 bits, Key size: 64, 128, 256
  8. GCM provides authentication also.
  9. Must be identifiable after decryption Ciphertext Stealing
  10. SHAttered Fuzzy hashing.
  11. Primality Test Multiplicative Group
  12. Multiplicative group
  13. RSA?? Extended Euclid,s Algorithm e is small, usually 65537.
  14. Trust = Sign their public key.
  15. The Irony