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
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 

Recently uploaded (20)

Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
%+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...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
%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
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
SHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationSHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions Presentation
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
%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
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 

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