HomeНаука и техникаRelated VideosMore From: Numberphile

Encryption and HUGE numbers - Numberphile

16771 ratings | 1002254 views
Banks, Facebook, Twitter and Google use epic numbers - based on prime factors - to keep our Internet secrets. This is RSA public-key encryption. More links & stuff in full description below ↓↓↓ Gold Vault: https://youtu.be/CTtf5s2HFkA This video features Dr James Grime (http://singingbanana.com/). Message from James: "Thanks to Dr Chris Hughes of the University of York who showed me how to find the RSA public key from my browser, and showed me how awesome they look when you print them out." Regarding the keys used for encryption: x, y prime Encode key E shares no factors with (x-1)(y-1) Decode key is D with E*D - 1 a multiple of (x-1)(y-1) Thanks to Drew Mokris for the animation: http://www.spinnerdisc.com/ NUMBERPHILE Website: http://www.numberphile.com/ Numberphile on Facebook: http://www.facebook.com/numberphile Numberphile tweets: https://twitter.com/numberphile Subscribe: http://bit.ly/Numberphile_Sub Videos by Brady Haran Patreon: http://www.patreon.com/numberphile Brady's videos subreddit: http://www.reddit.com/r/BradyHaran/ Brady's latest videos across all channels: http://www.bradyharanblog.com/ Sign up for (occasional) emails: http://eepurl.com/YdjL9 Numberphile T-Shirts: https://teespring.com/stores/numberphile Other merchandise: https://store.dftba.com/collections/numberphile
Html code for embedding videos on your blog
Text Comments (1989)
Tell me please why is 617 digits coded by 2048 bit? We need 4 bit for each digit (or not?).
Shreyash Parmar (27 days ago)
Why do they use the prime factors of a large number to keep the key secure? Couldn’t they just as well use any random number known only to the bank to secure the key?
Liam Grohs (27 days ago)
0:17 my number nightmares
Dylan Maddocks (1 month ago)
Anyone know where I can find some companies public keys?
Saksham Dobriyal (1 month ago)
lol
xKappash (1 month ago)
One of the worst videos of you. Bad example.
Aaron Hollander (2 months ago)
Public Keys should be called Public Locks.
Justin Chang (3 months ago)
He didn't tell us the formula to get the number
Movie Clips (3 months ago)
What was the use of banks secret number that you assumed 7 .
Mayank Jha (4 months ago)
Repeat, Please.
TheJudoJoker (4 months ago)
"That's an intersting mathematical fact but what will you ever use it for." People tell me this all the time 😂
Anna Walker (4 months ago)
I love the animations
Adam Walsh (4 months ago)
95835
Venkatesh babu (4 months ago)
Encryption dwells in 8 & 9.
Jonnathan Crane (4 months ago)
Math should be treated as not a study but an entertainment. That is why these people loves math so much.
Strike Raid (4 months ago)
Interesting, the big number is 64k+1 (or 2 if you count from 0 like a computer).
Asdew (5 months ago)
Hah, I use a 4096-bit key with my secure chatting server
Brian Dennehy (5 months ago)
This is fascinating stuff thanks for the vid
Aizen Adante (5 months ago)
I HEARD hehjshsbsh. X , an, zc ,n s😗😐kz:-[:-\(^^)
Lukas Aldersley (5 months ago)
I have made myself a Password-manager and used 8192-Bit. Might be a little overkill.
Anita Tromp (5 months ago)
I see now how Bitcoin is much better than trusting a company or using heavy gold for storing "value".
Bendjilali Mahdi (6 months ago)
but these two prime numbers are at least known by Rivest, Shamir and Adeleman. Than why arent they the richest peopole in the world instead of bill gates?
ronnel loggins (6 months ago)
The part where he said we will gloss over how he found the secret number 3 is the reason why we cannot complete the process
50PullUps (6 months ago)
How is this secure at all? 3 is public. 10 is public. The individual uses 3 and 10 to perform the operation on BADCHEF and sends the result to the bank... am I missing something. Couldn't a hacker just intercept their message and perform the reverse???
71866B (5 months ago)
you can only reverse the message if you have the private key. Since it's PRIVATE, no one knows what it is. The example they showed was a bad one, because they used 3 twice which results in confusion, but they only wanted to show the "strategy". The only way to get that private key is to factorize the big number. The thing with this is, that it is simple, but it will always work. To make it actually secure, people make the primes so big, that the necessary work to break it is impractical to do.
IamJacksColon4 (7 months ago)
NSA in USA has said they can decode any bit decryption. they have found a way.
aAaa aAaa (7 months ago)
NatWest? the bank? They went out of business decades ago...
Beti Fransisca (7 months ago)
I don't quite get it. Isn't RSA used alone too slow? and how does Twitter or Barclays apply the RSA algorithm?
Justin Chang (7 months ago)
What about you cubed the number by 1? And then if you see the remainder, the code will be ruined...... But you said that any number is Ok!
Nicolaus Maloney (8 months ago)
What is the formula for the secret number?
Jonasz Koran-Mekka (8 months ago)
If d is secret number it has to follow this rule: (encryption number) * d=1 mod phi(public key) where phi(public key)=phi(p*q)=(p-1)(q-1)
karthik k.c (8 months ago)
what is the formulae to get the secret number in ur video which was '3'????
Jonasz Koran-Mekka (8 months ago)
If d is secret number it has to follow this rule: (encryption number) * d=1 mod phi(public key) where phi(public key)=phi(p*q)=(p-1)(q-1) for example public key=55 phi(55)=phi(5*11)=(5-1)(11-1)=40 encryption number=3 3*d=1 mod40 d=27 because 3*27=81 and 81mod40=1
George Humby (8 months ago)
this is a channel about Mathematics, not computer science!
Jonasz Koran-Mekka (8 months ago)
My public key: 31415926535897932103417896096814579404275163 Public exponent: 65537 Ciphertext: 2713631666392455034339462966592841433809892 Can you decipher it?
Brad Cuykendall (7 months ago)
Jonasz Koran-Mekka
thedarkfreak (7 months ago)
Hah, I can't seem to use CrypTool 1 for this. Only way to have it import an RSA key is with a certificate package file(PKCS#12 format), and it won't accept one that doesn't have a cert. I can't create a cert because the secret key is so small that it's not large enough to sign even an md5 hash to create the cert... Oh well. I'm still pretty sure I have the right secret key, anyway.
thedarkfreak (8 months ago)
And the three digits before those are 319. Yay, I got that part right :D
Jonasz Koran-Mekka (8 months ago)
Hey, message is not encoded, it is just a number but small one. I can not verify a signed blob for this moment but I can tell that last digits of private key are ...505873 P.S. If you want to know, I am using CrypTool 1
megaelliott (8 months ago)
So solving the Riemann hypothesis would break all encryption systems, since we'd have a direct formula for calculating the prime numbers.
71866B (5 months ago)
Clearly no. The Riemann hypothesis has nothing to do with factorizing. it's about the pattern the primes have. To illustrate this, everyone assumes that the hypothesis is true. If it would make any problems with RSA, people would use Riemann without the proof and simply check if it worked or not. And if it never works, that would be the proof that the hypothesis is not true, which is incorrect. So the hypothesis is not a problem for RSA at all.
Mario Gomez (9 months ago)
But, what hapens when you use the letter "J" number 10? The remander would be 0, how do you decode back to 10, I mean, it´s OK from 1 to 9, what hapens when the remander repeats it self?
Adam Mc Garrity (9 months ago)
These animations are brilliant.
PoweredButchZ (10 months ago)
Of course Facebook is insecure. They don't care one bit about your privacy, much less 2048.
great kingkay (10 months ago)
By GCD method factoring a semi prime is easy if it is easy to factor all the numbers lesser or equal to the square root of the given semi prime.
Calbe Calle (10 months ago)
I still don't really understand. So the server has the key to decrypt the client's message, but how is the client supposed to decrypt the server's message? I mean only the server has the key and, therefore, the way to decrpyt it, but the client doesn't have access to that key. How are any of the messages from the server to the client supposed to be encrypted with the intent that the client can unencrypt them?
Vengirni (10 months ago)
You and the server have separate and different padlocks. You lock your messages with their padlocks, and they lock theirs with yours. The keys are with their original owners all this time.
THERESAPARTYINMYHEAD (10 months ago)
I dont understand why you need the original prime numbers (2 and 5) when in the example you just used the 10 to decode the message?
Andrew Pennebaker (10 months ago)
I protect my secrets with exponential semiprimes c = a^b... factoring should get easier as b increases, but a is large as well so hackers are SOL.
Kirillpoly GD (10 months ago)
Can you tell us about a circle as a limit regular polygon?
Unknown (11 months ago)
Use brown paper!
Ziggy Mondus (11 months ago)
Does this mean the usable prime numbers are going to keep growing in size, and 'therefore' need more and more energy to generate?
Iris Ariola (11 months ago)
2:20 what if he broke it with a rock?
michael jordan (1 year ago)
LOL what a nerd!!
musikdoktor (1 year ago)
if someone want the google number is... 138705158280867732416635127130627673556488876515656590166689092086246347644731574778771006622896662331093030013154294032773452102956420363690503874704615393265080730427822471001570447529822652491203733378840926364918036459019776407319842826754254624804376257149749341626108612910963459523602040911042453032381
1800 theplug (1 year ago)
Why don’t these big company’s use elliptic curve methods? Is rsa more secured?
Oreole1 (1 year ago)
3:14 PM
Hypercube2 (1 year ago)
Couldnt you just take all the known prime numbers and multiply then till u got the pretended number instead? or just get at least 1 similar or close result and work from there to be faster
gamewizl (1 year ago)
NSA has a lock cutter.
Remington Hale (1 year ago)
I have an equation that helps you factor numbers quickly... But, that's not important!
Remington Hale (1 year ago)
Even more difficult to believe... BANKS are going to have to change their ENCRYPTION process!! Because we'll KNOW Every Prime number. Either THAT, or get HACKED!!
Remington Hale (1 year ago)
Get me the NEWS - I should be DIVINE! 'Cuz I have the Equation... for EVERY Prime!
CarBricksCity (1 year ago)
Image if they use a number similar in size to Grahams number lol
Seven09 (1 year ago)
8:27 That is amazing :)
SUBHADIP BARDHAN (1 year ago)
is that a prime?
Timofei Gerasimov (1 year ago)
This is the clearest explanation of the RSA algorithm that I've ever heard.
Prty (1 year ago)
Could anyone please explain to me how the "secret number doesn't have to be the same as the number we used to raise the the original values to the power of.." ? How do you work out the same message if the encryption uses "3" but then the decryption uses "2" ? Or did I misinterpret what he said and the numbers do have to be the same number both ways, it just doesn't necessarily have to be 3? That would make more sense... Please help!
71866B (5 months ago)
you can't "choose" these type of numbers. The only choice you have are the 2 prime numbers and everything else is related to these primes. Since they took 2 and 5 as primes, the resulting public key and private key are the same (3), which is not the goal and this problem does not happen usually.
Leo Machado (1 year ago)
But why not to steal some ones code, multiply by 10 and take its cube root ??
71866B (1 year ago)
You don't even get integers from that. Encrypted character c is 7, cube root of 70 is 4.12128529981...
Nikhil Bhavar (1 year ago)
what is currently used? how long number?
KA KC (1 year ago)
So let me get this straight....if anyone figure out p and q, then they can decrypt the message, even if they dont know the "e" correct?
71866B (1 year ago)
e is still part of the public key, so this is not hidden. And yes, if you know p, q and e, you can completely recreate the private key.
Simple Reason (1 year ago)
Just wait until someone finds the wire clippers.
Jetman640 (1 year ago)
RSA can now go up to something like 16384 bit encryption iirc
आशुतोष (1 year ago)
heard such an explanation for the first time....mind blown
pAINN NN (1 year ago)
RSA i unbreakable i studied it it generates very large numbers
TheIBDH (1 year ago)
why do you need the prime factors of the number you do the modulus calculation with?
Biz Vlogs (1 year ago)
This is wrong... You don't encrypt each letter separately, that exposes you to frequency analysis and is quite easy to break. The message has to be all one number (and in practice, also salted)
Sammy Kaye (1 year ago)
4:10 decode != decrypt :)
TheMensCurlingChamp (1 year ago)
This dude looks like he's on some serious drugs
Graham Gillett (1 year ago)
interesting video but this large is used for what?
71866B (1 year ago)
the primes used for that must be hidden. If I say to you that my public key is 3 and 10, you automatically know that my primes I used were 2 and 5 and you can easily recreate my private key. They need to be this big to make it difficult to get what the primes were.
IqbalHamid (1 year ago)
@4.30 why is he cubing? Is it because 3 is the bank's secret number? Or is it because it was cubed originally and to reverse the process? If he chose a different number for the bank's secret number, this point would have been clearer. An unnecassry obfuscation.
Rob Sim (1 year ago)
This guy is too cute!
Bitter Tea (1 year ago)
Exactly how is "x^p-x is a multiple of 5 useful?" Smart people, please explain.
Arno De Jonghe (1 year ago)
What I don't understand is, if I try it. For example I want to encrypt the number 25. I cube it 25^3 =15625. Then I have to get the remainder of 10, so 15625/10 = 1562 remainder 5. So I would send the bank 5 right? Now, If the bank wants to decrypt my message they would cube my 5, so 5^3 = 125 and then get the remainder 125/10=12 remainder 5. So they would receive my message '25' as a 5? Can someone please help?
Arno De Jonghe (1 year ago)
thanks, now I get it. :)
71866B (1 year ago)
That's right and it's obvious that your example does not work. You're limited within a certain range which is explained pretty easily. If you take the remainder of 10, you cannot differentiate if the previous number was 1, 11, 21, 31 .... Every Number there ends up to 1 if I take the remainder of 10. So the maximum range is 10 (0 to 9) in this example. In BAD CHEF, you don't use numbers higher than 10, that's why this works. Usually the numbers are so massively big, that no one even care for this range and therefore do not even mention this. If you want to do a better test, take (7, 33) as public key and (3, 33) as private key. To encrypt a message, take the power of 7 and remainder of 33. To decrypt the message, take the power of 3 and then again the remainder of 33. With that, you have at least the complete set from A to Z and you can have fun with excel. These numbers were created from the primes 3 and 11 and the e number was 7.
Blank001 (1 year ago)
IF HE WROTE BAD WOLF...
Sajid Mustaqeem (1 year ago)
watch from 0:12
SilverDax (1 year ago)
why is James reading how many years until HL3 at the start of the vid
lobsterfork (1 year ago)
What I don't understand is that you have the massive number used for modular arithmetic, so why does someone need to know the two prime numbers to make if they already have the massive number?
Chad Krause (1 year ago)
Is there really *That* many prime numbers that are that big? you know it can be anything less than a certain number of digits, so why not just start multiplying every prime number together and compare?
Suwin Khamchaiwong (1 year ago)
I thought it was Tom Scott on the thumbnail.
Quantum Sandwiches! (1 year ago)
Thank you for sharing Fermat's Little Theorem.
Panda TV (1 year ago)
how do I know how to decrypt 1234 I can use 1 and 234 or use 12 and 34
According to me 2^(2048) = 32317006071311007300714876688670000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
According to me 2^(1024) = 179769313486231590772930519078900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
matszz (1 year ago)
I love your videos, and sometimes (usually) I don't understand fully. I find it interesting anyway. This video needs to be remade though, that made no sense what so ever.
KB Lake (1 year ago)
I dont understand. Given that the number is made up out of two primes only, isnt the number of possible solutions to reach that particular number very limited? I feel like i am missing something here.
F. Hawk (1 year ago)
It is harder to find fewer factors. The more factor a number has, the easier it would be to start finding those factors. For example, imagine if it was an even number: Straight away you would be able to divide it by 2 to break it down into a number half as large. What makes a large number like this hard to break down, isn't how many factors it has, but how few.
Raj Sodhi (1 year ago)
How was the secret number used? 3 right?
GiggitySam Entz (1 year ago)
Funniest intro ever X'D
It's Me (1 year ago)
None of this explained how the bank derived the 3 as the "secret number". He said he would gloss over that and come back to it, but never revisited the secret 3. He showed how the 10 was derived by two prime numbers, but those were 2 and 5, neither of which explain how the 3 was derived as the secret number. This was a terrible example, since the secret number was the same as the public number. It doesn't show how anyone grabbing the public number couldn't just use those exact same numbers to arrive back at the original message, defeating the entire purpose.
Anomolous Tesseract (24 days ago)
if you multiply the remainders by 10, it wouldn't be useful to you
Olav Martinus Njå (1 month ago)
Diego Paiva  i am confused... what is n in phi(n) representing?
Bobby (1 month ago)
Anyway I have a feeling that with bit slicing technology - making huge registers in a supercomputer that are instead of the 64 bit type are perhaps 4096 bits long will one day make a much easier job of factoring prime numbers. Who knows - such computers & powerful algorithms may already exist. Cryptology methods could already be broken as we speak.
Joss C (1 year ago)
Could that be related to A057896? (The best birth years, there's another numberphile on it I think) That's about numbers in the form m^k-m, and I believe both k values for all numbers on the list are prime
amir hosein kargar (1 year ago)
how fermat little theorem apply to this coding methode
amir hosein kargar (1 year ago)
why did you choose 3 for decrypting the coded message why 3how did u choose it
kiwin111 (1 year ago)
THIS VEDIOE IPISEED SEM E ORFF SO MUCH XD D D DDDDDDDDDD ;D]]]
about:blank (1 year ago)
what's this nonsense? I just use this for everything unsigned char totally_safe_encryption(unsigned char input) { return 255-input; }
Mas Mas (1 year ago)
Can anyone help me please ... I dont get it ... when he decoded the message he didn't use the original prime numbers ( 2 and 5 ) so why do he even need them ? any help is appreciated ...
ZachLuscher (1 year ago)
I don't understand how they get the secret number to cube the coded message back? 3 isn't related to the factors of 10? 5-2= 3?
fetchstix™ (1 year ago)
It's related to the fact that when you divide 3*3=9 by 4, you get 1- with 4 coming from (5-1)*(2-1). The video doesn't explain RSA that well tbh and I wouldn't know how to type out a real explanation without having to explain other bits and pieces.
John Smith (1 year ago)
I still don't get the last bit. Why is that code so useful today?
Sloth (1 year ago)
I agree. I think this whole video just creates more questions than it answers. Like what happened to the formula he was going to show us to figure out the uncracking code was 3? And yh, how does Fermat's little theorem help with any of this? It's a theorem about primes... is that all? Literally not a single application of it is referenced to.
aSneakyChicken (1 year ago)
Because a lot of modern encryption is based on prime numbers
Achmed (1 year ago)
Why don't they just use hash functions?
Xorume (1 year ago)
i guess that an information like a credit card number could be sent that way, but information that they don't have (can't think of any example) would need to be recoverable. but your idea makes sense, i have that same doubt now haha
Achmed (1 year ago)
But doesn't the bank already have your credit card number? Therefore they have its hash, which they can match to the hashed credit card number you sent.
Xorume (1 year ago)
if you want to recover the original information, a hash function is not useful as it represents the information but can't be broken into the original info. They're great for passwords and such but not for credit card numbers as you need to know the original number after you receive it.
Heisenberg (1 year ago)
Message from James: "Thanks to Dr Chris Hughes of the University of York who showed me how to find the RSA public key from my browser, and showed me how awesome they look when you print them out." Ehm.. is there any Dr Chris Hughes here that could show me how to see the RSA public keys in my own browser?
Nathan B (1 year ago)
There's a "google".
Ricky Tappenden (1 year ago)
Is there an explanation as to how to use different numbers other than the ones he is using here. As using the numbers in the video, when it gets in to double digits, the remainders are not correct. For example, T being the 20th letter, cubed is 8000/10 = 800 r0. with the 0 now your not getting anything other than 0. Other letters too are missing the tens unit from its final number
ForeverOfTheStars (2 years ago)
OK so it would take a classical computer thousands of years to break a 2048 bit code. would a quantum computer be able to do it any faster? from my understanding a quantum computer doesn't do calculations any faster than a classical computer, but it does many calculations at one, while a classical computer would have to do it step by step. (my understanding of quantum computers comes from veritasium's videos)
chris cooney (1 year ago)
Don't think of it just in terms of speed of calculation. A Quantum machine can exploit properties of physics that a classical computer can not. That is what makes Shor's algorithm work. Shor's algorithm itself is faster because it has a better runtime complexity than all other algorithms that are designed to find prime factors of large composite numbers.
loloynage (1 year ago)
Currently, real life quantum computers do not perform tasks as fast classical computers; but theoretically you are correct. Eventually our understanding of building quantum computers will catch up to classical computers and cracking the RSA key encryption will be trivial.
supertacticalbacon (1 year ago)
This would probably answer your question as best as it could be answered: https://en.wikipedia.org/wiki/Shor%27s_algorithm
xstuporman (2 years ago)
I absolutely love this explanation and video top marks guys!

Would you like to comment?

Join YouTube for a free account, or sign in if you are already a member.