Breaking RSA - Computerphile

แชร์
ฝัง
  • เผยแพร่เมื่อ 9 พ.ค. 2022
  • If you pick the wrong prime numbers, cracking RSA becomes a cinch. Dr Mike Pound explains the findings of researcher Hanno Böck
    ARS Technica Article: bit.ly/C_BReakingRSa_Article
    Hanno's Blog: bit.ly/C_HannoRSA
    / computerphile
    / computer_phile
    This video was filmed and edited by Sean Riley.
    Computer Science at the University of Nottingham: bit.ly/nottscomputer
    Computerphile is a sister project to Brady Haran's Numberphile. More at www.bradyharan.com

ความคิดเห็น • 389

  • @bluekeybo
    @bluekeybo 2 ปีที่แล้ว +1348

    The best lecturer on Computerphile, hands down.

    • @MAli-wu4rx
      @MAli-wu4rx 2 ปีที่แล้ว +26

      Together with prof. Dave !

    • @gloverelaxis
      @gloverelaxis 2 ปีที่แล้ว +8

      pounding off in the comments for the Good Doctor!

    • @niktedig853
      @niktedig853 2 ปีที่แล้ว

      100%

    • @IceMetalPunk
      @IceMetalPunk 2 ปีที่แล้ว +9

      @@gloverelaxis ...phrasing.

    • @SinanAkkoyun
      @SinanAkkoyun 2 ปีที่แล้ว

      True!

  • @JMPDev
    @JMPDev 2 ปีที่แล้ว +499

    “A lot of thought goes into generating random primes than I am doing justice in this video” - sounds like a great topic for a future video :)

    • @RenshawYT
      @RenshawYT 2 ปีที่แล้ว +7

      Yes please! That would be very interesting.

    • @HilikusMan
      @HilikusMan 2 ปีที่แล้ว +2

      I was going to say exactly the same thing. I was surprised by that statement and now I'm curious

    • @anne-zu9cv
      @anne-zu9cv 2 ปีที่แล้ว +2

      YESSS 😍😍

    • @CraigOpie
      @CraigOpie 2 ปีที่แล้ว

      It's easier to just generate a bunch of keys' N values, determine the product, and do a GCF with the target N. Use the same certificate tool to get the best results.

    • @CompiledGabriel
      @CompiledGabriel 2 ปีที่แล้ว

      Yes! Now I REALLY want that video

  • @halbronk7133
    @halbronk7133 2 ปีที่แล้ว +532

    I find it hilarious that for weak primes, the factoring algorithm runs faster than the primality test.

    • @Avorthoren
      @Avorthoren 2 ปีที่แล้ว +17

      Nothing special: algorithm works in the assumption that there are exactly two factors for n.

    • @nerze3157
      @nerze3157 2 ปีที่แล้ว +55

      @@Avorthoren That's not an assumption, that's a property of n.

    • @Jooolse
      @Jooolse 2 ปีที่แล้ว +15

      @@Avorthoren It actually is special to weak primes: if the two factors are not weak primes, the best factoring algorithm for a number with two prime factors would take exponentially more time than the primality test...

    • @Avorthoren
      @Avorthoren 2 ปีที่แล้ว

      @@Jooolse Of course they are weak. But what do you mean by "exponentially more" in this context..? Exponentially more by what parameter? :)

    • @Avorthoren
      @Avorthoren 2 ปีที่แล้ว +3

      @@nerze3157 Read carefully what I wrote.

  • @sharkinahat
    @sharkinahat 2 ปีที่แล้ว +181

    Generating random numbers is too important to leave it up to chance.

    • @aja749
      @aja749 ปีที่แล้ว +3

      Get out

    • @firstlast8847
      @firstlast8847 ปีที่แล้ว +2

      Lol

    • @rake1087
      @rake1087 ปีที่แล้ว +4

      No computer generates random numbers. A number that is generated with a mathematical function can never truly be random. We call random numbers Pseudo Random. Generating random numbers for encryption is a lot more complex than just choosing to numbers between A and B.

    • @xionix4
      @xionix4 ปีที่แล้ว +1

      I love this comment so much. xD

    • @MrHaggyy
      @MrHaggyy ปีที่แล้ว +2

      @Rake1087 you can't generate true random numbers from something deterministic like a turing machine. But on a real computer it's quite doable. Shift noisy ADC numbers or use quantum effects if your structure is low nm.
      Some servers are used so damn frequently that determinism isn't really a problem. The lifespan of the numbers is just too short and usage to random to keep track and brute force.

  • @elmo2you
    @elmo2you 2 ปีที่แล้ว +315

    While not directly related to this RSA "shortcoming", this video did remind me of another (arguably more fundamental) concern regarding RSA. It is widely known that the difficulty of factorizing the product of two large and random prime numbers, is that makes RSA work. However, when just 1 of those primes isn't truly random, maybe a fixed value or in any way deterministic or part of some limited/predictable pool/rotation of seemingly random possibilities, it becomes rather trivial to break the cipher (to anyone with knowledge about what makes this prime less random).
    Nothing new there. This "trick" has been used in CTF challenges. However, what has surprised me on several occasions, is that not many people appear to realize that it is this same factorization problem that makes it equally hard/impossible to detect any "weakened" key from the outside. In other words: it is nearly impossible to determine if a RSA initiated encrypted transmission is in fact secure, without access to the private key. From a set of private keys, a pattern in primes might still be spotted (although maybe not trivial). But from just public keys, this is certainly nearly impossible.
    In a way, you could say that RSA is just as good at hiding compromised security, as it is at providing secure cryptography. One may ponder on whether that is a desirable property of good cryptography. One may also wonder whether that might have been just a side effect, or who knows maybe intentional.
    The few times I have seen this being brought up, it was instantly discarded as irrelevant. Often in a surprisingly dismissive way. Usually with arguments along the way of: "if you don't trust who generated the keys, all bets are off anyways" or "organizations who take their security seriously, will do such a thing because of X Y Z". However, I can think of at least several scenarios in which a company may like to pretend to use very strong cryptography, while at the same time (secretively) provide a convenient way (e.g. to a 3rd party with "special interests") to eavesdrop on those "secure" transmission without much hassle.
    While accusations of any such a thing actually happening remain conspiracy theory, it is the nature of this factorization difficulty in RSA that also makes that it would be almost impossible to prove such a thing taking place (unless some closely guarded secret leaks out). Considering the history of the NSA and RSA (both individually and in relationship with each other), it feels to me like this RSA concern deserves more attention than it generally appears to get. Similar concerns (although for totally different technical reason) might be raised regarding the NSA's EC cryptography.
    But that's just my 2 cents.

    • @ClifBratcher
      @ClifBratcher 2 ปีที่แล้ว +29

      Conceptually, that's valid, but there's a lot of overhead. In the wild three letter agencies generally get the private keys from the originator. Heck, if your pockets are deep enough, some companies will sell them after signing a lengthy NDA.

    • @elmo2you
      @elmo2you 2 ปีที่แล้ว +10

      @@ClifBratcher No doubt true, to all you said. But all of that will leave evidence of collusion (which might be legal requirements in 1 jurisdiction, yet at the same time illegal according to another). It is exactly the plausible deniability aspect of this RSA concern, which might make it particularly useful to some parties (which might not be the typical 3 letter agencies; there are other scenarios).

    • @nathanp6928
      @nathanp6928 2 ปีที่แล้ว +10

      What do you mean when you say, “it is this same factorization problem that makes it equally hard/impossible to detect any ‘weakened’ key from the outside”?
      I assume that you mean a weakened key to be one comprised of a prime that isn’t truly random or not chosen properly.
      Perhaps the best way to see if an RSA encryption is weak is to assume the key isn’t random and try various algorithms that take advantage of different mistakes that can occur while creating the key, such as the ones used in the CFT challenges you mentioned.
      Assuming you have a wide variety of algorithms that check for mistakes, wouldn’t it be relatively easy to check if a key is weak i.e. by factoring n? Maybe you can’t prove with 100% certainty a key isn’t weak, because that might require a potentially infinite amount of algorithms, but after so many attempts wouldn’t it be safe to assume a key is strong with a high probability?

    • @squishmastah4682
      @squishmastah4682 2 ปีที่แล้ว +2

      My thoughts exactly.

    • @antonliakhovitch8306
      @antonliakhovitch8306 2 ปีที่แล้ว +7

      One example, by the way -
      You have a closed source messaging application that promises to be end-to-end encrypted (*cough cough* Whatsapp). The company wants to read its users' data, or let the government read the data. There are of course loads of methods with a closed source application, but a backdoor like this one (picking intentionally weak keys, or better yet picking strong keys with a specific predictable algorithm) would be comparatively hard to detect.
      In other words - you might trust the person you're talking to, but that doesn't mean you can trust the software they run.
      Admittedly this is all pretty niche and unlikely though

  • @python-programming
    @python-programming 2 ปีที่แล้ว +228

    Always a good day when a Mike Pound video drops!

  • @compuholic82
    @compuholic82 2 ปีที่แล้ว +92

    Just another bullet point in the long list of reasons why you should never ever implement cryptography algorithms yourself unless you really, really know what you are doing.
    Unfortunately many people think that because the formulas behind cryptography algorithms are easy to find, implementing them is also easy. There is a reason why you have specialists for cryptography.

    • @ExEBoss
      @ExEBoss 2 ปีที่แล้ว +8

      *OpenJDK* recently learned this the hard way.

    • @0xhhhhff
      @0xhhhhff 2 ปีที่แล้ว

      @@ExEBoss what do ye mean

    • @ExEBoss
      @ExEBoss 2 ปีที่แล้ว +2

      @@0xhhhhff See *Computerphile’s* video titled *“Psychic Signatures (Java Vulnerability)”* for explanation.

    • @zaco-km3su
      @zaco-km3su ปีที่แล้ว

      @@ExEBoss
      Not only them. Java in general did.

    • @zaco-km3su
      @zaco-km3su ปีที่แล้ว

      @@0xhhhhff
      They weren't the only ones with these issues.

  • @johnholly6280
    @johnholly6280 ปีที่แล้ว +13

    Definitely stealing this method for CTFs. I've been using a number field sieve to factor low-bit modulo numbers. This is awesome!

  • @gloweye
    @gloweye 2 ปีที่แล้ว +8

    Back in school, we did some RSA by hand, generally using primes up to 13. having a p, q = 7, 13 is a bit lower than generally secure, but it illustrates the point nicely.

  • @elraviv
    @elraviv 2 ปีที่แล้ว +8

    7:09 an interesting point here, you need to assume that a & b are integers.
    since b=(p-q)/2 a=(p+q)/2 they might be a fraction like if p=5 & q=2.
    fortunately "2" is the only even prime. so we are dealing here with two odd primes, so always
    (p-q) & (p+q) are even.

  • @Thats_Mr_Random_Person_to_you
    @Thats_Mr_Random_Person_to_you 2 ปีที่แล้ว +48

    Would love more videos on the challenges of generating good primes.
    As said its more complex that math.random, and this video shows that bad prime choice can destroy what is essentially an amazingly good encryption algorithm. So would love to know more!!! Its that nice mix of maths and computer science (almost like a hybrid of numberphile and computerphile!) that I think is really fascinating and resonantes with both audiences.
    Dr. Mike is really great at explaining even really complex topics, so would be great for more!!!

    • @CoughSyrup
      @CoughSyrup 2 ปีที่แล้ว +1

      A modified Maurer's algorithm that uses the Miller-Rabin probable primality test and a cryptographically secure PRNG modified to randomly select a number within a given range with uniform probability. You use Maurer's algorithm to build up a prime to the appropriate size from other, smaller, randomly found prime numbers.

    • @CoughSyrup
      @CoughSyrup 2 ปีที่แล้ว +1

      I suppose I should mention that the reason you do it this way, instead of just picking some random number uniformly in the appropriate range, checking its primality using Miller-Rabin, discarding it if its composite and repeating until you have two large prime numbers P and Q, is because using Miller-Rabin on numbers of that size becomes infeasible.

    • @MrHaggyy
      @MrHaggyy ปีที่แล้ว +1

      Some real systems just use hardware to generate true random numbers.
      You could generate switching noise by, well run your code, and measure anything (mostly core temp) with way too much precision. Shift the noisy bits and check for prime or initialize a random generator.
      Some servers simply use quantum effects of properly poorly designed transistors.
      Or you pay one employee enough to stay loyal and let them pick a number by hand that is used by a generator.
      An interesting field for a video.

  • @noir371
    @noir371 2 ปีที่แล้ว +1

    I have no idea what he’s talking about but I can’t stop watching

  • @anarcho.pacifist
    @anarcho.pacifist 2 ปีที่แล้ว +11

    Also when p-1 or p+1 is B-smooth for some small value of B (approx. B

    • @anarcho.pacifist
      @anarcho.pacifist 2 ปีที่แล้ว +2

      One more special method, is the One Line Factoring Algorithm proposed by William B. Hart (called HOLF), which can factorize numbers of the form p*(a*p+b), where p is prime and a and b are small. For example, numbers of the form: n = p*next_prime(p*k), where k is small (approx. k

  • @gdclemo
    @gdclemo 2 ปีที่แล้ว +62

    Interesting. I'm surprised that it finds the factors so quickly, even with so many random bits difference. You're effectively searching for the arithmetic mean ((p+q)/2) of the two factors, given the geometric mean (sqrt(pq)). I guess the 'trick' is that for numbers of similar scale, these two values are very close.

    • @Pystro
      @Pystro 2 ปีที่แล้ว +5

      It's not surprising at all if the first half of the bits are equal. In fact, that would mean it takes about 2 iterations!!! Let's say a is 333500 (6 digits). Then p and q are numbers of the form 333???, which means b is at max 499 (3 digits) and b² has at max 6 digits (probably 5, but that would only make it faster).
      Now, when you go through the algorithm, the first candidate a² will have 12 digits (or 11, but lets stick with 12). But (a+1)² will already be about 666000 larger than a²: a 6-digit difference. The square root of a 6-digit number is a 3-digit number - which is already on the order of the maximum value for b. When you try a+2, the value you'd get for b² would be 1334004 (7 digits) - which can't be possible, because we know that b² is a 6-digit number.

    • @shoo7130
      @shoo7130 ปีที่แล้ว +2

      The Wikipedia page for Fermat factorisation shows how b grows more quickly than a, which is how it manages to skip through the search space quickly.

  • @TonyGarbanzo
    @TonyGarbanzo 2 ปีที่แล้ว +36

    Any plans to have a video on quantum-resistant cryptography? Seems like a good time with the recent White House memo

  • @cernejr
    @cernejr 2 ปีที่แล้ว +2

    Really nice video. And I am playing with Sage again, after some 10 years. Mr. Euler and Mr. Fermat - it is truly amazing what you guys gave us.

  • @Lampe2020
    @Lampe2020 6 หลายเดือนก่อน +1

    Interesting that you only have in the private key, all the reference implementations I've found (and the one ChatGPT spat out) all have a two-part private key, made of (, ) and also using both…

  • @theDurman
    @theDurman 2 ปีที่แล้ว

    Love these little lectures! More concepts and interesting problems please!

  • @Rchals
    @Rchals 2 ปีที่แล้ว +5

    Hum, so this is a glimpse of what Professor Edward Frenkel was talking about the relations between P and Q in the NSA video... it is frightening to think what math techniques and tools may be under the radar that we will never know about...

  • @georgelza
    @georgelza 2 ปีที่แล้ว +2

    the math is way over my head, but again Dr Mike made a complex subject very simple to follow, Thanks you, always look forward to these presentations.

  • @waynemartin6065
    @waynemartin6065 2 ปีที่แล้ว +13

    Have you done a video on using quantum computing to break RSA?

  • @alfaromeocharliehotelbravo928
    @alfaromeocharliehotelbravo928 2 ปีที่แล้ว +9

    _RSA Hate Him for This One Simple Trick_

  • @Zorgoban
    @Zorgoban 2 ปีที่แล้ว +1

    Very nice! A video with a practical example! Not only dry theory as most of your videos.

  • @galloe
    @galloe ปีที่แล้ว

    Not sure if anyone has mentioned this, but I love how you've repurposed continuous feed (dot matrix) paper! Also, your writing is so clean and legible, which makes it perfect for this application!

  •  2 ปีที่แล้ว +1

    I watch each of these lectures. To learn but also just to relax.

  • @DedicatedAngler
    @DedicatedAngler 2 ปีที่แล้ว +5

    I love this channel. it's encouraged me to start a degree in computer science, I'm just starting second year and I'm really excited.

  • @alessioprovenzano1768
    @alessioprovenzano1768 2 ปีที่แล้ว +2

    Maybe you can use a factor K for N: X^2 + K*N = Y^2 and using K as an iterator.
    For example: 313 * 113 = 35369 = N, if you pick K as equal 3 you get 3*35369 = K*N = 106107 so take the square root of ceil(3 * 35369) = 326;
    326^2 - 3 * 35369 = 169 = 13^2
    326 - 13 = 313 = P
    326 + 13 = 339 = Q * 3
    For example: 17 * 11 = 187, K = 1 -> ceil(sqrt(K*N)) = 14 and 14^2 - 187*1 = 3*3 -> 14 + 3 = 17, 14 - 3 = 11

  • @Ormaaj
    @Ormaaj 2 ปีที่แล้ว +17

    Ah yes, been reading Hanno's blog for years. His "feisty duck" newsletter is also always a good read. How very unsurprising to see Hanno's excellent work make an appearance. :)

    • @xionix4
      @xionix4 ปีที่แล้ว

      Beside myself that you actually started this comment with "Ah yes." xD Nothing wrong with that.

  • @legostory33
    @legostory33 2 ปีที่แล้ว

    please post more computerphile. I find my computer science classes incredibly boring, but these videos I cant stop watching. Makes me love computers!

  • @AcornElectron
    @AcornElectron 2 ปีที่แล้ว +17

    I’m not a programmer or coder but when Mr P speaks I listen.

    • @generalmanyara
      @generalmanyara 2 ปีที่แล้ว +2

      *Dr. P.
      I fully agree though. I never miss any of his computerphile videos.

    • @AcornElectron
      @AcornElectron 2 ปีที่แล้ว +2

      @@generalmanyara when he fixes my dads cancer I’ll call him (and any non medical doctor) Doctor. Until then he’s Mr Pound.

    • @IceMetalPunk
      @IceMetalPunk 2 ปีที่แล้ว +5

      @@AcornElectron Wow. Way to invalidate the amount of work that goes into getting a PhD...

    • @AcornElectron
      @AcornElectron 2 ปีที่แล้ว +1

      @@IceMetalPunk 10 years is gone like that ‘snap’

    • @xybersurfer
      @xybersurfer 2 ปีที่แล้ว +1

      @@IceMetalPunk it's not mandatory to call someone by their title. no work was invalidated here

  • @edwardkent1503
    @edwardkent1503 ปีที่แล้ว +1

    A side note - any modulo with a prime base creates a group under multiplication, which is why you mentioned finding the inverse of phi_n - I think this is an awesome example of pure maths such as group theory actually being used in action! :)

  • @realdarthplagueis
    @realdarthplagueis 2 ปีที่แล้ว +6

    Great video!
    What about making a video about Peter Shor's algorithm for quantum computers?

  • @GrandMarkimus
    @GrandMarkimus ปีที่แล้ว +4

    "I'm not a genius, it just wasn't difficult". I'm using this

  • @SirMo
    @SirMo 2 ปีที่แล้ว

    This was so well explained, wow. Nicely done!

  • @JxH
    @JxH 2 ปีที่แล้ว +7

    Presumably, someone could "sweep the web", looking for weak Public Keys, and then focus their attacks on those poor unfortunates.

  • @ashlandwithouttheshd
    @ashlandwithouttheshd 2 ปีที่แล้ว +4

    Six minutes in I had to check, am I on numberphile or computerphile

  • @silakanveli
    @silakanveli 2 ปีที่แล้ว +1

    Unparalleled explanation skills!

  • @ecsodikas
    @ecsodikas 2 ปีที่แล้ว +2

    3:04 a Lisp developer was born that second.

  • @jacob_90s
    @jacob_90s 2 ปีที่แล้ว +2

    13:35 pick random p, find the nearest prime
    pick q such that q > [p + 2^n/2] (or you can choose whatever difference is large enough for you), and find the nearest prime above that The important part is if the q you pick doesn't match, you have to generate a completely brand new number each time.

  • @cmuller1441
    @cmuller1441 2 ปีที่แล้ว +49

    There used to be a big problem with some hardware servers with too low entropy to generate p and q at boot. Often 2 different servers where using the same p or the same q.
    So there's N1=p . q1
    And N2=p . q2
    Taking the biggest common prime factor of 2 numbers is fast so do that on N1 and N2 to get p then you get q1 and q2 with simple division.
    2 servers hacked together...

    • @imveryangryitsnotbutter
      @imveryangryitsnotbutter 2 ปีที่แล้ว +8

      Ah okay, so it's not RSA that's broken, it's that it's just not being implemented correctly in the first place.

    • @NoNameAtAll2
      @NoNameAtAll2 2 ปีที่แล้ว +19

      @@imveryangryitsnotbutter rsa layer itself was done correctly
      it's the rng lib below was flawed

    • @xDenro
      @xDenro 2 ปีที่แล้ว +2

      Yes, for those interested there is more details about this kind of exploit in a fairly famous paper titled Ron was wrong, Whit is right (can easily find a free pdf googling)

    • @qzbnyv
      @qzbnyv 2 ปีที่แล้ว

      @@NoNameAtAll2 Sounds like a problem I’d also expect to see out of Haskell’s cryptonite lib that most Haskellers use atm.

    • @nerze3157
      @nerze3157 2 ปีที่แล้ว

      @@imveryangryitsnotbutter It's always an implementation problem

  • @carlospulpo4205
    @carlospulpo4205 2 ปีที่แล้ว +4

    This is pretty neat method to reduce search space , I will have to give it a run. I would use this against the issuing CA, not the server key. Then re-issue your own certificates. Sign your own firmware images. Some firmware signing techniques will use an intermediate certificate and leaf that are both generated at the time of signing and each time a new image is signed. It would be interesting to analyse the p q generation in such a circumstance.

  • @TomTheDutchy
    @TomTheDutchy 2 ปีที่แล้ว

    Owh yes, dr Pound is always on point!

  • @dezmondwhitney1208
    @dezmondwhitney1208 2 ปีที่แล้ว

    Really great Lecture. Well Done.

  • @ForcefighterX2
    @ForcefighterX2 2 ปีที่แล้ว +3

    This is exactly the reason why one must never implement cryptographic algorithms as they are explained in textbooks. They lack all these real world tweaks which are necessary to prevent very specialized attacks for specific cases.
    There even have been smartphone apps in the past (sorry for not remembering the names - they were short lived), where cryptographers essentially criticized exactly that: It was a textbook implementation which does not hold up against real world scenarios, resulting from specific hardware, bad random number generators, limited memory, similar user mindsets, etc...

  • @supersu6138
    @supersu6138 2 ปีที่แล้ว

    Mike pound is back ! Missed you man

  • @proggenius2024
    @proggenius2024 หลายเดือนก่อน

    I love this! Even without understanding all

  • @graemepennell
    @graemepennell 2 ปีที่แล้ว +9

    love this stuff, even though my maths was always garbage.

  • @Chlorate299
    @Chlorate299 2 ปีที่แล้ว +2

    That looks like it's a pretty handy test algorithm to make sure your encryption is properly secure.

  • @serta5727
    @serta5727 2 ปีที่แล้ว

    Mike makes the day

  • @TheFinagle
    @TheFinagle 2 ปีที่แล้ว +2

    I wonder if you could make this work better on well chosen primes by assuming they will be well chosen. Start at root of N + the root of the root of N and start going both up and down (instead of a=a+1 you have a+g and a=g for g starts at 1 and g=g+1 each iteration.

  • @Alfenium
    @Alfenium 2 ปีที่แล้ว

    Aahh man, ComputerPhil the expert does it again!

  • @JedidiahWB
    @JedidiahWB 2 ปีที่แล้ว +3

    It seems that your starting guess for "a" could actually be anything, and as long as your initial guess is close, this method is a (relatively) fast way to explore out from that point? Is my understanding correct that the lesson learned from this isn't "don't pick two primes that are close in size", but rather "don't pick primes that are near intuitive starting positions"? And then you have the issue that, if you tell all of the RSA algorithm providers to avoid all of the areas that are near intuitive starting positions, you've drastically, and perhaps cataclysmically, reduced the search-space of what 'acceptable' primes are in-use by RSA library providers?
    I feel like I'm missing something here, posting to be corrected and be a little less wrong.

  • @moradan81
    @moradan81 ปีที่แล้ว

    When I started following Numberphile I couldn't understand what was all the fuss about with the primes. Then I started following computerphile and it slowly started to make sense.

  • @timschulz9563
    @timschulz9563 2 ปีที่แล้ว +2

    10:16 In this pythonic context, the ^ gave me small heart attack. But then I remembered it's not Python.

  • @TorATB
    @TorATB 2 ปีที่แล้ว

    How fast could you calculate 'd' (public key) when using optimized code for QBit Processor? Even when 'p' and 'q' are "difficult" numbers?

  • @zizo1998aaa
    @zizo1998aaa ปีที่แล้ว +1

    please make a cryptography playlist of Dr. Mike Pound videos

  • @NoEgg4u
    @NoEgg4u 2 ปีที่แล้ว +3

    RSA has been broken. It has a secret back door:
    correct horse battery staple

  • @BlitzPSH
    @BlitzPSH 2 ปีที่แล้ว +11

    isqrt(n) + 1 -- "so that's the ceiling"
    only given that n isn't square, otherwise it's the ceiling + 1 :)

    • @ethandavis7310
      @ethandavis7310 2 ปีที่แล้ว +1

      Nope. Ceiling is the smallest integer greater or equal to its argument, so ceil(n) == n if n is an integer

  • @husseinnasser
    @husseinnasser 2 ปีที่แล้ว +5

    This is brilliant.. and scary !
    I would imagine not a lot the RSA libraries will pick a good far apart primes.
    And what makes this scary is parallelizing this is quite easy.

    • @anarcho.pacifist
      @anarcho.pacifist 2 ปีที่แล้ว +3

      Actually, it's highly unlikely to randomly generate two 1024 bits, that have the first 512 bits identical. Unless the random number generator is not really random.

  • @benjaminshropshire2900
    @benjaminshropshire2900 2 ปีที่แล้ว +1

    Have any RSA client libraries implemented checks to reject certs with weak keys?

  • @entropie-3622
    @entropie-3622 2 ปีที่แล้ว +2

    I wonder if this problem generally occurs if the attacker, for whatever reason, has a good estimate on p/q?
    In which case it is not so much that choosing p and q similar is inherently weak it is just that it is natural to try for p/q close to 1 and it is more natural to end up with an implementation of choosing p and q close to each other rather than specifically 20% apart.
    Kinda how 1234 is not a weaker number than any other 4 digit number but it is bad as a password because the human brain can more easily remember it and thus prefers to choose it.

    • @anarcho.pacifist
      @anarcho.pacifist 2 ปีที่แล้ว

      There is a special method for this, called the One Line Factoring Algorithm proposed by William B. Hart.

  • @beanie5851
    @beanie5851 2 ปีที่แล้ว

    I see Mike Pound, I click. I am a simple man.

  • @DarkCydeCA
    @DarkCydeCA 2 ปีที่แล้ว

    would it be possible to have an n that is the product of several sets of p and q primes and would that make it "easier" for figure out d? just thinking that having a bigger pool of primes to use might make it somewhat quicker somehow.

    • @ethandavis7310
      @ethandavis7310 2 ปีที่แล้ว

      Yes. The more primes in a number's factorization the easier it is to factor it. This is exactly why RSA only uses n that are the product of TWO large primes

  • @neunzehnvierundachtzig
    @neunzehnvierundachtzig 2 ปีที่แล้ว +5

    This video might get a million views :)

    • @3xpl0i79
      @3xpl0i79 2 ปีที่แล้ว

      Yeah ::

  • @schenjayaki5026
    @schenjayaki5026 2 ปีที่แล้ว

    Nice explanation 😄

  • @topquark22
    @topquark22 2 ปีที่แล้ว

    Common factor attack: Given two private keys n1 = p * q1, n2 = p * q2, using the same p, then p = gcd(n1, n2), which is easy to compute with Euclid's algorithm, then q = n / p.
    This actually happened for a large number of public keys in the wild, that had been generated using a faulty prime number generator. This finding was revealed in a paper from February 2012.

  • @tsuchan
    @tsuchan 2 ปีที่แล้ว

    I haven't understood how I would end-up with two close values of p and q. Because when I generate an RSA key pair, I don't choose those numbers (I'm not even aware of them). I might be asked by the keygen program to 'generate some randomness' by moving my mouse (or some such). So what's the arrangement where these values are 'badly chosen'? How could I [arrange that | rely on that | expect that] as a hacker?

    • @ethandavis7310
      @ethandavis7310 2 ปีที่แล้ว +4

      It's not user error. It's the people who developed the software that chooses the primes who are at fault when weak n are generated. You need to trust that the software you're using is generating strong n, not yourself

  • @Mostlyharmless1985
    @Mostlyharmless1985 ปีที่แล้ว +1

    The good news is since getting the weak primes out of the keys is so trivial, it's equally trivial to make a test at key creation and just reject the keys and start over.

  • @datvuong7420
    @datvuong7420 5 หลายเดือนก่อน

    I find that if you add phi(n) to the d key, then the new d = old d + phi(n) still works, is that new private key?

  • @joseville
    @joseville ปีที่แล้ว

    7:30 If we maintained a list of squares where S]x] = x^2, then
    ceil(sqrt(N)) = bisect.bisect_left(S, N)
    which can be computed in O(lgN).
    I'm guessing the issue is that N is so large that maintaining a sufficiently long list S would be impractical.

  • @youngprogrammer5258
    @youngprogrammer5258 2 ปีที่แล้ว

    I tried many ways, I even modified my iptables rules, firewall restrictions, and all the possible ways, but still I cant get reverse shell. Netcat doesn't listen to my reverse shell, so I stucked in the root me room for more than a week. I need help, please anyone suggest me any ideas to overcome this.

  • @Mrdresden
    @Mrdresden 2 ปีที่แล้ว +1

    Good stuff! Look forward to the video on selection of random primes

  • @dadanon2874
    @dadanon2874 2 ปีที่แล้ว

    Have no idea what you said but I enjoy it. Thank you sir and tha k you computerfile

  • @mrme488
    @mrme488 ปีที่แล้ว

    plz ! i hope you make a video about chacha20/xchacha20 cipher with more details !!

  • @Hadrian117
    @Hadrian117 2 ปีที่แล้ว +1

    I love the way he talks

  • @djhokage1
    @djhokage1 2 ปีที่แล้ว

    5:38 I'm relieved that not even Dr. Mike Pound can escape the inevitable sharpie marks on your hands.

  • @7darkgames764
    @7darkgames764 ปีที่แล้ว

    You explained very well for a person that doesn't know anything about math

  • @sylwester9761
    @sylwester9761 2 ปีที่แล้ว

    Pls do a video about yubikey or sth similar

  • @alexfilmwriting
    @alexfilmwriting 2 ปีที่แล้ว

    So then how close is 'too close'? Once you know the threshold for 'too close' couldn't you just begin your search outside that boundary? Basically reducing your search space?

    • @entropie-3622
      @entropie-3622 2 ปีที่แล้ว +4

      Sure, but reducing the search space would only shave off about the amount of time you needed to crack the key if it was weak which by assumption is not that much time.
      A strong key that would require 100 years to crack doesn't really mind if you shave 1 hour off.
      And then there is the hilarious situation where the key actually was weak and your algorithm can't capitalize on it because you purposefully excluded checking for it.

  • @BlessedForever888
    @BlessedForever888 2 ปีที่แล้ว

    thank you!

  • @nocturn9x
    @nocturn9x 2 ปีที่แล้ว

    this was scary af and also interesting!

  • @uubaidullah
    @uubaidullah 2 ปีที่แล้ว

    muchas gracias❤❤

  • @therealquade
    @therealquade 2 ปีที่แล้ว +2

    I'm 4 minutes in and I have a 3-part question. if P and Q are Prime numbers, How many primes are in the "usable range of primes", and is that few enough that you could precalculate them into an, albeit large, rainbow-table? How large of a drive would you need to store the rainbowtable for current RSA prime sizes? I'd also like to clarify "usable range of primes", because, the generation method for primes, will not give all primes for a range, and is a much, much shorter list.

    • @ShakesB13r
      @ShakesB13r 2 ปีที่แล้ว +2

      Quick search reveals: If you were to collect the power of the sun for 32 years in a dyson sphere and input that into a computer at the maximum theoretical efficiancy. Then that computer could count to 2^192. That is still a bit short of the 2^1024 range that RSA seems to use. In Short: Not physically feasible until we have explored a few layers deaper into physics.

    • @ethandavis7310
      @ethandavis7310 2 ปีที่แล้ว

      @@ShakesB13r Always nice to refresh my understanding of how large a ~1000 bit number is

    • @therealquade
      @therealquade 2 ปีที่แล้ว

      @@ShakesB13r That misses part of the nuance of my question. That's true if you're counting every number starting at 2^1, which you most certainly aren't, so that's a massive reduction in calculation time, and second, The method used for generating random numbers is not true randomness. True digital randomness doesn't exist, we use pseudo-random numbers, which vastly reduces the numberspace even further for larger numbers. If you have the method of pseudo-random numbers that was used, and reverse engineer it to know what factors go into generating, such as pulling specific memory addresses and clocks, you can replicate that very limited space of generation, and re-generate the same pseudorandom numbers. in theory... It would still be an enormous number-space, but nowhere near 2^1024, I'd honestly doubt that the actual numberspace exceeds 2^50, because if it pulls from memory addresses, there's a very finite number of possible instructions, and if that memory space was, say, system memory, It's hypothetically possible to get exact strings, particularly if the psudo-random generation is less secure. It's actually why there's that one room full of lava-lamps on a camera being used to generate random numbers that's owned by cloudflare for SSL, and they do that exactly for the reasons I've described above. Which means this method couldn't be used for cracking cloudflare's prime generation, but the end-user does not have access to that level of RNG, they only have PRNG.
      What I want to know is, if that's why cloudflare is using lava lamps for RNG, how real is that threat of exploiting PRNG? How much can you narrow down a PRNG Numberspace? does PRNG even fill the entire numberspace evenly, or is there an asymetrical distribution that could be exploited? What factors go into PRNG and can that be exploited?

    • @666Tomato666
      @666Tomato666 2 ปีที่แล้ว +1

      @@therealquade there are n/log(n) primes smaller than n; so there are about 2^2037 primes that are 2048 bit long. No, we can't physically iterate over them. Worse still, there are about 2**267 particles in the observable universe, so we don't have even the amount of matter necessary to store them (let alone keep track of them all)
      So, while, yes, it's is a shorter list, and yes, it's a much, much shorter list, we are operating with numbers so gigantic that tens of *orders of magnitude* is an insignificant rounding error. As such, shortening that list is completely meaningless compared the (humanly) uncountable void that are the typical numbers used in RSA.

    • @therealquade
      @therealquade 2 ปีที่แล้ว

      @@666Tomato666 that's Half of my question answered, How about the other half of my question, How much further can that be narrowed down by the predictability of PRNG? Is that not also tens of orders of magnitude of a difference, if not more?

  • @sp10sn
    @sp10sn 2 ปีที่แล้ว

    Is n the same as N? I didn't catch why there was a change but he did refer to N once as, "our original en." So....?

  • @shapshooter7769
    @shapshooter7769 2 ปีที่แล้ว +1

    Ahh the nightmare is back... Had to do both RSA and quadratic sieving by hand during my discrete maths exam.

  • @majiddevops6856
    @majiddevops6856 2 ปีที่แล้ว

    The thumbnail is savage 😂

  • @rickharold7884
    @rickharold7884 2 ปีที่แล้ว

    Love it

  • @rushikesh8132
    @rushikesh8132 2 ปีที่แล้ว +1

    I enjoyed this so much ! Starting to think I am a nerd Yes :)

  • @macktheripper7454
    @macktheripper7454 ปีที่แล้ว

    Protect this man at all costs.

  • @LeeSmith-cf1vo
    @LeeSmith-cf1vo 2 ปีที่แล้ว

    If you are being choosy about your "random" numbers then are they really random?

  • @myuniquehandle
    @myuniquehandle 2 ปีที่แล้ว +1

    function rsaAlgorithm(base, exponent, modulus) {
    return base**exponent % modulus
    }

  • @martinmusli3044
    @martinmusli3044 2 ปีที่แล้ว +1

    How do you get two similar prime numbers in Python?
    Wondering how to reproduce this...

    • @evgeniipavlov5440
      @evgeniipavlov5440 2 ปีที่แล้ว +1

      You could choose two similar (say m, n ≈ 2ˆ256, m-n≈2ˆ128 starting long integers), use simpy.nextprime() on both and verify that the resulting primes are different and actually prime (not just semi-prime). If they coincide, you could just use simpy.nextprime() on one of them several more times.

    • @martinmusli3044
      @martinmusli3044 2 ปีที่แล้ว

      @@evgeniipavlov5440 Thanks man. Worked fine!

  • @joaovernieri8409
    @joaovernieri8409 ปีที่แล้ว +1

    Awesome video, however u cant apply this formula u made (N = a² - b²) for all cases... just the one you picked ;)

  • @GeorgeMonsour
    @GeorgeMonsour 2 ปีที่แล้ว

    Separated at birth? : Dr. Pound and Kripke of 'Big Bang Theory'

  • @kkgt6591
    @kkgt6591 2 ปีที่แล้ว

    I was about to wreck havoc on the internet but Mike said don't that stopped me.

  • @EdMcF1
    @EdMcF1 2 ปีที่แล้ว

    3:58 '...it would take you longer than the lifetime of the Universe, or some unrealistic amount of time...'.

  • @BohdanTrotsenko
    @BohdanTrotsenko 2 ปีที่แล้ว

    brilliant

  • @klyanadkmorr
    @klyanadkmorr 2 ปีที่แล้ว +1

    MUST CORRECT MIKE's equation it's the STAR WARS TIEFIGHTER of (n)!♥

  • @miraculixxs
    @miraculixxs ปีที่แล้ว

    So. How is openssl generating p, q?

  • @ivahardy4885
    @ivahardy4885 2 ปีที่แล้ว

    But just where does Dr Mike get his sweaters...?