Тёмный
No video :(

RSA Encryption From Scratch - Math & Python Code 

NeuralNine
Подписаться 366 тыс.
Просмотров 30 тыс.
50% 1

Опубликовано:

 

5 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 60   
@_base_2
@_base_2 Год назад
Please keep this type of in-depth video coming! I learned a tremendous amount from your clear explanations, and am able to implement my own programs based on your clear, and logical, step-by-step walk through. Please, more like this!!! 😃
@Peacfull
@Peacfull 10 месяцев назад
here is the code if you are lazy to write: import random import math # n= p.q #phi(n) = phi(p.q)=phi(p).phi(q) = (p-1). (q-1) #phi(n) = (p-1.q-1) def is_prime (number): if number < 2: return False for i in range (2, number // 2 +1): if number % i == 0: return False return True def generate_prime (min_value, max_value): prime = random.randint (min_value, max_value) while not is_prime(prime): prime = random.randint(min_value, max_value) return prime def mod_inverse(e, phi): for d in range (3, phi): if (d * e) % phi == 1: return d raise ValueError ("Mod_inverse does not exist!") p, q = generate_prime(1000, 50000), generate_prime ( 1000, 50000) while p==q: q= generate_prime(1000, 50000) n = p * q phi_n = (p-1) * (q-1) e = random.randint (3, phi_n-1) while math.gcd(e, phi_n) != 1: #gcd=greater common denometer != not equal e = random.randint (3, phi_n - 1) d = mod_inverse(e, phi_n) message = input("Enter your message to Encrypt ") print ("Prime number P: ", p) print ("Prime number q: ", q) print ("Public Key: ", e) print ("Private Key: ", d) print ("n: ", n) print ("Phi of n: ", phi_n, " Secret") message_encoded = [ord(ch) for ch in message] print ("Message in ASCII code: ", message_encoded) # (m ^ e) mod n = c ciphertext = [pow(ch, e, n) for ch in message_encoded] print (message," Ciphered in: ", ciphertext) Decodemsg= [pow(ch, d, n) for ch in ciphertext] print ("back to ASCII: ", Decodemsg) msg = "".join (chr(ch) for ch in Decodemsg) print("from ASCII to TEXT: ", msg)
@mattanderson2074
@mattanderson2074 24 дня назад
A year late to the party, but thanks for the great explanation and the fantastic demo in Python. I'm familiar with the concepts of RSA already, but it's always good to have it explained clearly for folk who haven't looked at the concepts and logic behind it and your explanation was great.
@efox29
@efox29 Год назад
I havent watched the video yet, but title alone and topic. Thumbs up.
@tanzir3678
@tanzir3678 Год назад
Good one. Yes, thorough explanation covering Maths and all is much beneficial than just demonstration of using some libraries. There are tons of people out there who would follow the second approach. And that makes you standout.
@borisakelovic9930
@borisakelovic9930 5 месяцев назад
This "from the scratch" is sooo well done , Bravo
@sl3262
@sl3262 7 месяцев назад
I really like these more in depth videos. For me, learning the fundamental principles of how something works is by far the best way to understand it. Definitely do what has been suggested elsewhere: watch the theory then try and implement it in Python before seeing how it's done! More of these please, if you can!
@lennuard_6998
@lennuard_6998 Год назад
coding challange: only watch the math part and (try to) implement it yourself before watching the coding part
@micleh
@micleh Год назад
Exactly. I often do this in my lessons (flipped classroom principle): watching a video at home, ironing out diffuculties in class and them implementing it in the lessons so as to figure out if the theory has been understood.
@certitolla202
@certitolla202 Год назад
Done 😸✅✅
@Radical9535
@Radical9535 Год назад
thanks i really like this being on the cyber security side of things i have to teach myself coding basically so these videos are great on stuff like this and now i have an understanding of how rsa works mathematically so thanks!
@huliang9001
@huliang9001 8 месяцев назад
I really like these more theory based videos explained from scratch. In this way, I really learned something deep.
@amirabas8817
@amirabas8817 18 дней назад
Brother, you didn't put any corner of Python outside of your empire That's impressive 👏
@aritraghosh999
@aritraghosh999 3 месяца назад
Please make more videos like this it helps us code by understanding the concepts
@lintop3908
@lintop3908 Год назад
Yeah, I really wanted you to release a video on this topic from scratch
@ghAmputeeAtheist
@ghAmputeeAtheist Год назад
you can get the inverse of e mod phi with pow(e,-1,phi)
@micleh
@micleh Год назад
I like such videos a lot. I'll definitely use this video in my upper sixth computer science course here in Germany since RSA is a topics on the curriculum. The implementaion will be in JAVA, though, since this is the language used in Years 11-13.
@Abomin81onVlog
@Abomin81onVlog Год назад
I enjoyed this video greatly.
@RajapuRishitha-jc6xy
@RajapuRishitha-jc6xy 3 месяца назад
If n is known, since n can be written as the product of p and q only(given p and q are prime numbers), we can find p and q right?
@Ungerlogik
@Ungerlogik Год назад
I live the mix of these kind of videos and cool usefull stuff (like pomodoro). 😊
@DroughtBee
@DroughtBee 3 месяца назад
Doesn’t this leave itself open to frequency analysis because all the letters are just given (effectively for our purposes) random numbers? Why is this better than just any other mono-alphabetical code?
@paulthomas1052
@paulthomas1052 Год назад
Thanks - another really useful lecture and practical demo. Cheers 😃
@TritdawG
@TritdawG 9 месяцев назад
Great video; thank you for sharing.. super helpful!
@nicolamombelli2149
@nicolamombelli2149 Год назад
Great explanation and nice example in Python. Thanks.
@bartektrybaa3922
@bartektrybaa3922 Год назад
I found this usefull for my studies. Thanks :D
@ahmehhhd
@ahmehhhd Год назад
amazing video. we need more of these
@user-ku6gw1wm6b
@user-ku6gw1wm6b 12 дней назад
Nice one.
@Peacfull
@Peacfull 10 месяцев назад
nice work but where you selected 7, and that part i did not get it completely how did you come up with 7. I have wachted that part again and it was not clear for me. but still your explanation was very good. thank you. keep up the good work.
@salahtamimy5322
@salahtamimy5322 4 месяца назад
Thank you 👍
@aryanlivi3553
@aryanlivi3553 7 месяцев назад
Great Explanation!!
@huliang9001
@huliang9001 8 месяцев назад
Really awesome! Thanks bro!😀
@nejathakan5521
@nejathakan5521 Год назад
Keep this kind of videos please.
@silentkille4
@silentkille4 7 месяцев назад
loving the content its helping me alot
@tcgvsocg1458
@tcgvsocg1458 Год назад
really interesting these day i look in aes 256 bits encry^tion i don t know whitch is best but both are really interresting
@seeesh_
@seeesh_ Год назад
Hi, I would like to ask some Pandera tutorial to do data quality, doing some advance transformation on data. That's possible?
@harsharya828
@harsharya828 Год назад
Thanks for this knowledge.
@khairysuleiman4
@khairysuleiman4 9 месяцев назад
Thanks Mr. Best!
@prosodyspeaks4036
@prosodyspeaks4036 9 месяцев назад
yeah! more like this!
@WahranRai
@WahranRai 10 месяцев назад
27:43 Which calculator did you use
@garydunken7934
@garydunken7934 5 месяцев назад
Microsoft Windows calculator
@WahranRai
@WahranRai 5 месяцев назад
@@garydunken7934 Thank you, i already found it !
@cpp705
@cpp705 Год назад
thanks i needed it
@chyldstudios
@chyldstudios Год назад
awesome, thanks for making this video,.
@JO06
@JO06 11 месяцев назад
Thank you brother
@danielw8620
@danielw8620 Год назад
May I ask what your educational background is? Are you self taught, did you go to college for a Math degree/CS degree? Thanks
@piotrmazgaj
@piotrmazgaj Год назад
Very nice.
@PawitSahare
@PawitSahare Год назад
And awesome video bro
@CthRage8946
@CthRage8946 Месяц назад
You can make someone very rich!
@bhagyalakshmi1053
@bhagyalakshmi1053 Год назад
How to create vlu ?
@JarppaGuru
@JarppaGuru 6 месяцев назад
29:01 so how hard brute force private key if we know s n and m. bob can do s=m^d mod n too mean try every thing 141=15^d mod 143 why we sign using d and n when we should sign using phi_n alices=m^d mod phi_n-1 bobs=alices^m mod e = 1 if message and sign match at least all test i calculated LOL now bob cant brute force alice d... or i have formula for that do its same simple LOL but u made tutorial i say dont do s=m^d mod n you give away private key. he knows all but one. you need have atleast 2 unkown number in equation to make it harder
@JarppaGuru
@JarppaGuru 6 месяцев назад
26:26 bob know e n and he make c. and m=c^d mod n r we clear yet? how hard is find out d? bob know all but d. we can brute force private key so long as we get our original m=15 alice public key need hold something its e and n alice privet key have to have some number and p q. n and phi we can calculate and e is just mod inverse d so how hard brute force m=c^d mod n. if we know all but not d xD
@Andr_e_y
@Andr_e_y 2 месяца назад
It's a shame there's no salt here. Thank you😊
@raspberryPi1337
@raspberryPi1337 Год назад
Hello, how old are you?
@heptex8989
@heptex8989 Год назад
What kind of question is that lmfao
@zstar8397
@zstar8397 9 месяцев назад
Hey hope you are doing alright just I wanna say that GOD loved the world so much he sent his only begotten son Jesus to die a brutal death for us so that we can have eternal life and we can all accept this amazing gift this by simply trusting in Jesus, confessing that GOD raised him from the dead, turning away from your sins and forming a relationship with GOD.
@PawitSahare
@PawitSahare Год назад
Don't reply this comment
@iamperoplayer2121
@iamperoplayer2121 7 месяцев назад
ok
@PawitSahare
@PawitSahare 7 месяцев назад
@@iamperoplayer2121 ok thanks
Далее
Breaking RSA - Computerphile
14:50
Просмотров 359 тыс.
Cute kitty gadget 💛💕
00:23
Просмотров 4,7 млн
when you have plan B 😂
00:11
Просмотров 5 млн
Encrypted File Transfer via Sockets in Python
19:54
Просмотров 21 тыс.
Encrypt SQLite Databases with SQLCipher
14:58
Просмотров 13 тыс.
Coding Encrypted Chat in Python
20:33
Просмотров 47 тыс.
RSA algorithm step by step example
20:41
Просмотров 106 тыс.
Makefiles in Python For Professional Automation
13:43
Modern Graphical User Interfaces in Python
11:12
Просмотров 1,5 млн
Cute kitty gadget 💛💕
00:23
Просмотров 4,7 млн