Encryption program in Python 🔐

  Рет қаралды 139,168

Bro Code

Bro Code

Күн бұрын

#python #course #tutorial
import random
import string
chars = " " + string.punctuation + string.digits + string.ascii_letters
chars = list(chars)
key = chars.copy()
random.shuffle(key)
#ENCRYPT
plain_text = input("Enter a message to encrypt: ")
cipher_text = ""
for letter in plain_text:
index = chars.index(letter)
cipher_text += key[index]
print(f"original message : {plain_text}")
print(f"encrypted message: {cipher_text}")
#DECRYPT
cipher_text = input("Enter a message to encrypt: ")
plain_text = ""
for letter in cipher_text:
index = key.index(letter)
plain_text += chars[index]
print(f"encrypted message: {cipher_text}")
print(f"original message : {plain_text}")

Пікірлер: 141
@BroCodez
@BroCodez 2 жыл бұрын
import random import string chars = " " + string.punctuation + string.digits + string.ascii_letters chars = list(chars) key = chars.copy() random.shuffle(key) #ENCRYPT plain_text = input("Enter a message to encrypt: ") cipher_text = "" for letter in plain_text: index = chars.index(letter) cipher_text += key[index] print(f"original message : {plain_text}") print(f"encrypted message: {cipher_text}") #DECRYPT cipher_text = input("Enter a message to encrypt: ") plain_text = "" for letter in cipher_text: index = key.index(letter) plain_text += chars[index] print(f"encrypted message: {cipher_text}") print(f"original message : {plain_text}")
@riufq
@riufq 2 жыл бұрын
can you made video about the compaction encryption?
@mr.randomly2799
@mr.randomly2799 Жыл бұрын
​@@Love.Stefan yk wether you like it or not python is going to pretty much be the number one most used language
@la_sn3ak3r19
@la_sn3ak3r19 Жыл бұрын
it doesnt always work
@la_sn3ak3r19
@la_sn3ak3r19 Жыл бұрын
When you add string.uppercase it messes with the decryption process occasionally.
@eyoel308
@eyoel308 Жыл бұрын
what is ur coding app
@AM-mv6ro
@AM-mv6ro 2 жыл бұрын
I'm 67 and was a complete beginner at programming when I started learning about computing in December 2021. I started with your Python beginner course and I am now a senior Python developer with 3 juniors that I oversee. Thank you Bro Code for your hard work and dedication.
@gainzovereverything7719
@gainzovereverything7719 2 жыл бұрын
Teach me 😢
@kamal9294
@kamal9294 2 жыл бұрын
Nice
@AM-mv6ro
@AM-mv6ro 2 жыл бұрын
@@gainzovereverything7719 Sure, how can I assist you?
@riufq
@riufq 2 жыл бұрын
67?! everytime i see people above 50 years old want to learned programming. You guys just make me feel motivated.
@gainzovereverything7719
@gainzovereverything7719 2 жыл бұрын
@@AM-mv6ro How did you get your job after learning python?
@katipunero_ph9920
@katipunero_ph9920 4 ай бұрын
I stop playing with Python almost a year.. After watching this video I easily regain some of my old python skill than other video.. Thank you
@avivagmon9315
@avivagmon9315 2 жыл бұрын
Bro code on his way to be a complete chill dude that dedicates every video to a fundraiser. Pfp checks out
@AmanuelBerhanuTsehay
@AmanuelBerhanuTsehay 2 ай бұрын
Awesome video as usual. I also learned we can use the random.seed() function to replicate the shuffles and even use for passwords import random import string chars = string.ascii_letters + string.digits + string.punctuation + " " chars = list(chars) while True: main_choice = input("insert E to Encrypt, D to Decrypt or Q to Quit: ").lower() if main_choice == "e": print("Encryption Mode:") plain_text = input("Enter plain text: ") random.seed(input("Enter password: ")) key = chars.copy() random.shuffle(key) cipher_text = "" for char in plain_text: cipher_text += key[chars.index(char)] print(f"cipher text: {cipher_text}") elif main_choice == "d": print("Decryption Mode:") cipher_text = input("Enter cipher text: ") random.seed(input("Enter password: ")) key = chars.copy() random.shuffle(key) plain_text = "" for char in cipher_text: plain_text += chars[key.index(char)] print(f"Plain text: {plain_text}") else: break print("--------------------------------------")
@disdoodanimations
@disdoodanimations 2 жыл бұрын
great video, your explaining is really good, i cant wait for your next video!
@zabehullahalizadeh2310
@zabehullahalizadeh2310 2 жыл бұрын
Thank you Bro Code . You are really active and you are doing very well. Keep on going
@skylineshorts5075
@skylineshorts5075 2 жыл бұрын
Thanks for the tutorial bro, can u make some pygame tutorial?
@zohaibwaris-q8x
@zohaibwaris-q8x 5 ай бұрын
THANKS BRO 💙 these are the highest quality videos I found on you_tube related to programming.
@JarppaGuru
@JarppaGuru Жыл бұрын
1:32 x = range(33, 127) # 33-126 ascii = "" for n in x: ascii += chr(n)
@moneyexploit
@moneyexploit 10 ай бұрын
Love You Bro Code I Learned Python Paid Courses But They Teach Me About Basic Things In Python. But I Want to Deeper Understand in Python. Then I See Your Video I Learns a Lot's of Things More Than My Paid Courses. Thank you So Much. Love Again
@shazamvirk750
@shazamvirk750 2 жыл бұрын
Amazing information..thanks sir
@MacN_
@MacN_ Жыл бұрын
These videos you've created are so helpful. thank you so much!!! NM✌
@oumarelfarouqdiarra6619
@oumarelfarouqdiarra6619 2 жыл бұрын
Thanks for all these helpful and very interesting videos ☺️
@RODRIGO6803
@RODRIGO6803 Жыл бұрын
I am too in college working on a final assignment, I will use this to encrypt user passwords for the project. thanks a lot! like and sub.
@recon6660
@recon6660 2 жыл бұрын
wow that was awesome knowing how this work.
@KavinduSamarasinghe-z4i
@KavinduSamarasinghe-z4i 11 ай бұрын
thamcuu lavuuuu ummmmmmmmmmmmmmmmmmmmmmmmma..Because of you i've got a place in our uni ❤
@kapibara2440
@kapibara2440 Жыл бұрын
Just fantastic 😊
@rickkk09
@rickkk09 2 жыл бұрын
ma nigga is rocking it
@Deformed
@Deformed 2 жыл бұрын
Hey brother, can you PLEASE do a video on your IDE setup and configuration? Or is it just default PyCharm as-is? I don't really like VS Code
@serenity.111
@serenity.111 2 жыл бұрын
great contents, thank u so much
@M7ilan
@M7ilan 2 жыл бұрын
Do more please with this topic.
@OpGamer-kj4ve
@OpGamer-kj4ve 2 жыл бұрын
Can you also teach us Ceaser encryption and other types of encryption methods?
@JarppaGuru
@JarppaGuru Жыл бұрын
#quick and dirty ceasar alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" plain_text = "IHATEAPPLE" cipher_text = "" key = 13 # 1-25 also can use key=alpha.index("N") # 13 is btw ROT-13 so you get to flies same time xD for letter in plain_text: l = len(alpha) a = alpha.index(letter) k = a + key if k >= l: k = k - l cipher_text += alpha[k] print(cipher_text) plain_text = "" for letter in cipher_text: l = len(alpha) a = alpha.index(letter) k = a - key if k < 0: k = k + l plain_text += alpha[k] print(plain_text)
@novianindy887
@novianindy887 Жыл бұрын
this video is Ceaser Encrytion itself
@skeledum
@skeledum Жыл бұрын
Thanks man, you helped me out
@ardcodelover
@ardcodelover 2 жыл бұрын
Nice
@aijazbirsfun547
@aijazbirsfun547 8 ай бұрын
Radhe Radhe Sanatan Hi Satya Hai Jai To All Gods & Godesses Jai Baba Farid Ji Radhaswami Ji
@EclipseRoblx
@EclipseRoblx 2 жыл бұрын
Can you please make a tutorial on how to make a “Key input” code? like when you enter the correct key in the input it sends a console log
@MetalowyRobot
@MetalowyRobot Жыл бұрын
#Checks if key is equal to input. userIn=input() key="example123" if userIn==key: print("Yes") #Checks if key is inside the input. userIn=input() key="example123" if key in userIn: print("Yes") #Checks if key is a permutation of the input. userIn=input() key="example123" cntIn=[0]*256 cntKey=[0]*256 check=True for i in userIn: cntIn[ord(i)]+=1 for i in key: cntIn[ord(i)]+=1 for i in range(256): if cntKey[i]>cntIn[i]: check=False break if check: print("Yes")
@romeo9015
@romeo9015 5 ай бұрын
One way to make this more secure is to replace each character with a random number of characters. Then input more random strings of characters in between it. Keep track of what all these random string are equal to and implement a way of storing it separately from the message (another file works fine for testing). This will mean every message will have a different key, just like in the video. The method I described SHOULD prevent most simple cracking algorithms from accessing your data. You could further encrypt your keys with a separate, private algorithm if you’d like more security. There are also ways to encrypt the actual syntax in your algorithm if you need even more security (I forgot what this is called). If you need security for business or just doing wanna risk using your own, just use existing methods. It’s just more reliable.
@terrifictable
@terrifictable 2 жыл бұрын
can you make a video about rsa/aes encryption (in c or c++)?
@meshoDev
@meshoDev 2 жыл бұрын
We can use AES for better encryption Good video🫡✨ Keep it up bro 😎
@BroCodez
@BroCodez 2 жыл бұрын
true but that might be too complex for beginners at this level
@johnhansen4794
@johnhansen4794 2 жыл бұрын
@@BroCodez There's a reason I paint my one time pads in Oil.
@Cxrruptwd
@Cxrruptwd Жыл бұрын
I just created the ultimate encrypter, it's not released yet and I'm planning on keeping it closed source to prevent hackers from hacking it.
@mr.unknown5307
@mr.unknown5307 2 жыл бұрын
Please make a course on shell scripting
@tamz_exe
@tamz_exe 3 ай бұрын
i'm a little late to this video, but this was a fun project. instead of making a decryption method i made it so it saves both the plain and encrypted texts into a json file, like a password manager
@codingworld-programmerslif430
@codingworld-programmerslif430 2 жыл бұрын
Hello, how about you start cyber security course for beginners...?
@ogfakii9187
@ogfakii9187 2 жыл бұрын
Basically a Caesar Cypher
@VAIBHAVMALHOTRA19
@VAIBHAVMALHOTRA19 9 ай бұрын
Can you please explain for loop part in this code
@rtygbf
@rtygbf Жыл бұрын
this helped me soo much
@ClevererChain99
@ClevererChain99 5 ай бұрын
But the key changes every time, so how would you decode older messages?
@SashoSuper
@SashoSuper Жыл бұрын
The enemy is not getting the message, but so is your team.
@adedamolayusuf7018
@adedamolayusuf7018 2 жыл бұрын
your voice sounds a bit different in this video. Hope to see your face in a video
@BroCodez
@BroCodez 2 жыл бұрын
It might be because I've been sick lately 😷
@adedamolayusuf7018
@adedamolayusuf7018 2 жыл бұрын
@@BroCodez Sorry to hear that bro hope you are feeling better now.
@Mosinsarmory
@Mosinsarmory 8 ай бұрын
You can make it much shorter by changing it to string.printable which contains all of those characters.
@Python902
@Python902 7 ай бұрын
Well Bro Kindly start the series of Cyber Security yeah AI kindly
@lukas5238
@lukas5238 2 жыл бұрын
Bro can you show us how to make a preset Timer in Tkinter where if the time is up it prints a text?
@D4C_1891
@D4C_1891 5 ай бұрын
But how can I decipher it if the kye is random ?
@short-shots
@short-shots 2 жыл бұрын
Cant believe we are getting them for free
@jameshall4853
@jameshall4853 2 жыл бұрын
How would you expand on this if you could?
@Koshak87
@Koshak87 Жыл бұрын
07:55 - top 10 anime betrayals.
@woodesther8939
@woodesther8939 Жыл бұрын
Pls it doesn’t work when you run the program value error comes indicating that the letter is not in list
@ajflink
@ajflink 6 ай бұрын
I made a substitution cipher....Then, I got carried away and now it is a multistaged cipher but the shift value is randomized and contained but in its own cipher in the output. So, one input can result in over 50 different outputs, yet they all decipher to that input. Edit: I also made it random if the cipher itself is then ciphered again before being outputed.
@Force_Drippz
@Force_Drippz 8 ай бұрын
if i want the key to not be shuffled so i can share a code to friend like a secret code how do i do it?
@_______9021
@_______9021 10 ай бұрын
hi i want to know is there any way to encrypt the question or how to find out the key of the cipher code?
@massswitch6661
@massswitch6661 11 ай бұрын
Nice video, what is the "f" stand for, and also the " : " next to the words.
@talaramadan1895
@talaramadan1895 10 ай бұрын
this is an f string, and the colon is used in the for loops, to end a condition. so its like for index in chars do this (aka:)
@HunaBopa
@HunaBopa Жыл бұрын
Your explanation is incredibly excellent Chris. What are you doing these days? I want your help to create an app. Would you do that?
@A_Basic_Guy
@A_Basic_Guy Жыл бұрын
This didn't work for me, there is nothing wrong with the code but when i reopen the program the encrypted message or numbers to say wil come out as a hole different thing.
@AllenDende
@AllenDende Жыл бұрын
broo fire fire,
@Dm__0612
@Dm__0612 2 жыл бұрын
Thank you ❤️
@iloveBTSforever
@iloveBTSforever 11 ай бұрын
I have a .wiaw virus from the Stop/Djvu family of viruses. Can this video help?
@karolynepessoa8959
@karolynepessoa8959 Жыл бұрын
i need do make a app with symmetric and asymmetric cipher. Do you think that i can use this program??
@gingerdarkgd
@gingerdarkgd 11 ай бұрын
one problem with this program is that so it generates random key every time you run it and if i close the program and reopen it i cannot decrypt the text, to solve this you could save key with someone indicator like e-; and then ask user for this indicator and then check if this key exist in the file
@FLKS-3310
@FLKS-3310 Жыл бұрын
how do i make it print the characters that i choose?
@nicholasdemakis616
@nicholasdemakis616 2 жыл бұрын
why cant i see the second enter a message to encrypt im using pycharm is there a setting i need to turn on?
@rm_commando5067
@rm_commando5067 2 жыл бұрын
Is there a way to make the user input a key for the code to use?
@Someone-nw7yc
@Someone-nw7yc Жыл бұрын
probably ask for user input and let the program return/print the original message if password correct
@trxlly
@trxlly 2 жыл бұрын
Thanks!
@mdfaisalmahamud
@mdfaisalmahamud 2 жыл бұрын
javascript project video upload please
@Ahmed_760
@Ahmed_760 10 ай бұрын
how can we encrypt videos?
@Purple-Astro
@Purple-Astro Жыл бұрын
thanks bro
@SunPodder
@SunPodder 2 жыл бұрын
Waiting for your react.js course 🙌
@Der_Rotsteiner
@Der_Rotsteiner Жыл бұрын
How to use "filetree" in Python
@-hackers_industry
@-hackers_industry Жыл бұрын
"How the heck do you spell punctuation!?": Bro Code, 2023
@ProfessorX-f2t
@ProfessorX-f2t 5 ай бұрын
🔐
@saseda
@saseda Жыл бұрын
How 2 people to using it? 😊😊😊
@danielhod53
@danielhod53 2 жыл бұрын
bro what keyboard and mic you use?
@vadimkondratiev7214
@vadimkondratiev7214 Жыл бұрын
a question from a noob. If the encryption is random every time, how can it be used to encrypt and decrypt the messages on a constant basis?
@Wenyi_Statistics
@Wenyi_Statistics 11 ай бұрын
please use goole translator to translate Chinese into English. 因为randomruffle()在整个程序的最外层,先执行random,生成了一个暗号,再执行加密解密。这个暗号在程序本次执行过程中是不变的,但是在每次点击三角,也就是新的一次执行全部程序的时候,暗号会出现变化。你说的情况当randomshuffle()在加密和解密两段代码的内部时会出现。
@talaramadan1895
@talaramadan1895 10 ай бұрын
if you still have the program running without ending and starting again, it would have the same key. but here when he re starts the program it generates a new key. so a way to overcome this is by saving the key in a variable after its been randomly generated for the first time. hope this helps!
@zarqanawaz7129
@zarqanawaz7129 8 ай бұрын
Which libraries require for it
@djangoKid-uz9oe
@djangoKid-uz9oe Жыл бұрын
What IDE are you using?
@leroydennisaidoo7968
@leroydennisaidoo7968 6 ай бұрын
Pycharm
@Schizophrenism
@Schizophrenism Жыл бұрын
Wich version of python is this?
@JC-fd8ho
@JC-fd8ho Жыл бұрын
is that substitation encryption ?
@pythonmini7054
@pythonmini7054 Жыл бұрын
It only works on txt file not on docx files
@al-cadaalachannel3194
@al-cadaalachannel3194 2 жыл бұрын
Did you begin advanced level bro?
@seanchristiangarais3189
@seanchristiangarais3189 2 жыл бұрын
Can I do this on C#?
@TotallyNotAPie
@TotallyNotAPie 11 ай бұрын
Well you basically just translate the python code to c# code. Although its not gonna be exactly the same
@paxi5765
@paxi5765 Жыл бұрын
can you decrypt when key lost
@talaramadan1895
@talaramadan1895 10 ай бұрын
no
@obaidali8813
@obaidali8813 2 жыл бұрын
Please we need Javascript
@aweawertable
@aweawertable 2 жыл бұрын
Do i need to be good in math to be a programmer?
@TotallyNotAPie
@TotallyNotAPie 11 ай бұрын
Not for everything but you do need some basic math like algebra
@aayushshrestha1210
@aayushshrestha1210 Жыл бұрын
what text editor is that
@Goofyahmc
@Goofyahmc 10 ай бұрын
Intellij
@wsnippets
@wsnippets 2 жыл бұрын
1st comment
@mehdi_craft
@mehdi_craft Жыл бұрын
I think its a little hard
@reincarnationofthelightking
@reincarnationofthelightking 5 ай бұрын
i don't know what are you talking about and even after reading comment section I didn't still get it, sorry guys but I am dumb asf, I hope I will understand it after watching other videos,.
@pawan4920
@pawan4920 2 жыл бұрын
B
@wsnippets
@wsnippets 2 жыл бұрын
Love you bro code
@DADIroRohman
@DADIroRohman Жыл бұрын
w
@zstar8397
@zstar8397 Жыл бұрын
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.
@deletoblue6059
@deletoblue6059 2 жыл бұрын
no way
@arshiaa104
@arshiaa104 2 жыл бұрын
Cumment
@JarppaGuru
@JarppaGuru Жыл бұрын
1:54 x = range(32, 127) # 32-126 ascii = "" for n in x: ascii += chr(n)
Functions in Python are easy 📞
10:38
Bro Code
Рет қаралды 653 М.
What Is Dynamic Programming and How To Use It
14:28
CS Dojo
Рет қаралды 1,6 МЛН
Ful Video ☝🏻☝🏻☝🏻
1:01
Arkeolog
Рет қаралды 14 МЛН
Coding Encrypted Chat in Python
20:33
NeuralNine
Рет қаралды 52 М.
Caesar Cipher Program in Python | Encryption and Decryption With Caesar Cipher
17:31
Fabio Musanni - Programming Channel
Рет қаралды 54 М.
How is this Website so fast!?
13:39
Wes Bos
Рет қаралды 1,3 МЛН
7 Cryptography Concepts EVERY Developer Should Know
11:55
Fireship
Рет қаралды 1,4 МЛН
How To Design A Completely Unbreakable Encryption System
5:51
Half as Interesting
Рет қаралды 514 М.
Modern Graphical User Interfaces in Python
11:12
NeuralNine
Рет қаралды 1,6 МЛН
Алгоритмы на Python 3. Лекция №1
1:20:50
Тимофей Хирьянов
Рет қаралды 5 МЛН
Python Beginner Project: Build a Caesar Cipher Encryption App
25:10