Modular Inverses in Python 3 (PicoCTF 2022 #03 basic-mod2)

แชร์
ฝัง
  • เผยแพร่เมื่อ 17 ก.ย. 2024
  • Help the channel grow with a Like, Comment, & Subscribe!
    ❤️ Support ➡ j-h.io/patreon ↔ j-h.io/paypal ↔ j-h.io/buymeac...
    Check out the affiliates below for more free or discounted learning!
    🖥️ Zero-Point Security ➡ Certified Red Team Operator j-h.io/crto
    💻Zero-Point Security ➡ C2 Development with C# j-h.io/c2dev
    👨🏻‍💻7aSecurity ➡ Hacking Courses & Pentesting j-h.io/7asecurity
    📗Humble Bundle ➡ j-h.io/humbleb...
    🌎Follow me! ➡ j-h.io/discord ↔ j-h.io/twitter ↔ j-h.io/linkedin ↔ j-h.io/instagram ↔ j-h.io/tiktok
    📧Contact me! (I may be very slow to respond or completely unable to)
    🤝Sponsorship Inquiries ➡ j-h.io/sponsor...
    🚩 CTF Hosting Requests ➡ j-h.io/ctf
    🎤 Speaking Requests ➡ j-h.io/speaking
    💥 Malware Submission ➡ j-h.io/malware
    ❓ Everything Else ➡ j-h.io/etc

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

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

    For the sake of learning , RSA uses the multiplicative inverse in order to generate the private key (For extra info you know what to do ). John you are a beast , Greetings from Greece !

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

    The "Extended Euclidean Algorithm" is well worth a look, since it is one of the most fundamental algorithms in computer algebra and cryptography, and in particular it is the key to understanding and computing modular inverses.
    ### Since the gcd of two numbers a,b (suppose a>=b, otherwise swap) is computed step-by-step via the ordinary Euclidean algorithm,
    a_0 = a, b_0 = b
    for n = 0,1,2... until r_n = 0:
    (1) q_n = a_n div b_n
    (2) r_n = a_n - b_n * q_n (which implies 0

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

    Hello from Brazil, thank you so much. Awesome video!

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

    Thanks John. It’s good to see you’re still learning too. I think it’s helps us feel that it’s ok to always be learning and you can’t know everything. Thanks again for the time and energy you put in.

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

    Another golden video from John. He makes looks thing easy and interesting. But the video doesn't show thousand of hours spent learning these skills, approach and thought process.

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

    I like what you did here. I just imported mod_invers from smypy then used modulasinv = mod_inverse(number, 41)

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

    great approach John!

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

    Awesome, Thanks John.

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

    John Hammond's channel: come for the infosec lessons & news; stay for the word "shenanigans". 😊

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

    This is so awesome and valuable :DD

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

    Thks !

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

    since 41 is a prime number, you could use Fermats little theorem to compute the modular inverse of x by calling pow(x, 39, 41), which works for older python versions as well.

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

    Nice Nazaré Tedesco image........ Brazil dude!! hahahahahaha love u John...

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

    Yeah...I love the math...I do the math all the time, I'm the best at math. Thank you for your video, kind sir.

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

    Awesome John!

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

    loving this series

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

    Dude it such a relief to see that I was not alone crossing my eyes when reading about reverse modulo. I though I was ultra dumb to not getting it right away

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

    def modular_inverse(a, c):
    for n in range(c):
    if (a * n) % c == 1:
    return n
    return -1

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

    Hello from Brazil 🇧🇷 🖖🏼

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

    Short but perfect

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

    Best example of understanding a modular inverse i could find (that actually was my google answer, i just did the search a bit differently lol):
    The multiplicative inverse of “a modulo m” exists if and only if a and m are relatively prime (i.e., if gcd(a, m) = 1).
    Input: a = 3, m = 11 Output("pow(3, -1, 11)"): 4 Since (4*3) mod 11 = 1, 4 is modulo inverse of 3(under 11)
    And not to be confused with 1/3 mod11 (or "(3 to the power of -1) mod11"). I think python did it this way just to simplify it for us. I tried to get a calculator to reproduce the result, to no avail.

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

    Thank you so much for doing this. I massively over thought this challenge as simple and straightforward as it turned out to be! I got so frustrated when I couldn't do it but I knew trusty Hohn Jammond would save the day!

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

    Brother beard looks cool

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

    Great job John👊💜

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

    hoping that you solve all that pico ctf challenges...thanq

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

    beautiful

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

    When you encrypt a file, does the algorithm apply to the binary directly or other values are used (as shown in the challenge)?

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

      RSA is not a stream cypher like AES. The encrypted part is always the size of the modulus. So if your mod is 16 bit you need 2 bytes to save the value.

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

    seeing the Extended Euclidean Algorithm brought back trauma from a few months ago when i first learned about rsa encryption and tried to compute my own keys, it still not working btw

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

    It boggles my mind how hackers of yesteryear plied their trade without internet search engines. The accumulative knowledge they had to seek (and remember) wasn't a mouse click away!

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

    I just want to know how to execute the code and the result shows on the right side of the screen and not the bottom!

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

    What about @John Hammond using Nazare Tedesco's meme. lol

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

    Python tutorial when?

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

    It would help us if you provide the python script

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

    Seeing that you don't understand the definition of this inverse in your native language makes me feel less bad about not understanding it when reading the definition in a foreign language. ;-)

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

    comment

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

    Hi John
    I want you help??

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

    This meme is Brazilian lol