If you really want to get fancy, you can use "frequency analysis" to decode the message: Let's assume that the message is in English for this example. 1. Look at the distribution of how often the letters come up. 2. The most common letter in English is the letter E. 3. So, at least if the message is long enough, one of the most common letters in the encrypted message should map to E. 4. So we can get the shift by simply looking at the distance between E and the most common letter, because that would map the most common letter back to E.
@@NeuralNine You can make it useful by applying different shifts in different cases. For example, add 7 when i is even and subtract 3 when it's odd. If you make up more complex rules, it would be very difficult if not impossible to brute-force it.
5:31 I particularly don't understand what is going on with the 26-80 thing, I have seen other blog tutorials too where this something is subtracted from 26 in order to get back to the original value from an encrypted value; but I found an easy solution. Just use negative numbers. Put shift = -5 and it will work fine to give the original result back. (But thanks to the tutorial tho)
Thank you for what you do! Your films are very interesting and I teach a lot. I have been learning to program in Python for several months, I am currently 12 years old :) By the way, I come from Poland, so even there it is helpful!
I just want to point out that you're not actually implementing a "Caesar" cipher. You're using a shift value of 7, so you're actually implementing a ROT-7 cipher. Caesar cipher is specifically when the shift value is 3. All other values of the shift produce rotation ciphers, but not a Caesar cipher.
@@_zelatrix While Julius Caesar himself did use a shift of 3 letters, Augustus Caesar only used a shift of one. The shifting of the letters in this way is noted as the Caesar Cipher but can also be noted as a ROT-7 or ROT-5. Neither is technically incorrect. The script itself is a Caesar Cipher as it can be changed to rotate a different amount so it could be 3 it could be 12 etc, so the script isnt a rot-7 cipher he just happens to only demonstrate a shift of 7.
Thanks for the video but can you make a decryption video on your latest codes fro caesar cipher, cause im having difficulties decrypting it using python
After coding it myself I saw your video and learned It can be done a lot shorter with your methods, Thank you! Just one thing - Is it just me or does the shift is limited to 25, and not above it?
try shift %= 26 - that should solve the problem where the shift gets limited to 25 and reverting back to the normal alphabet when the shift is higher than 25
Thank you for making this video. I found the decryption was fine for string.lowercase but when I tried it with string.printable the results started to get a bit inconsistent. Any ideas?
Hello There! Is there a way to decrypt the encrypted word/sentence? And is there a way for the user to choose how many shift they want? I would appreciate if anyone can answer me!
Hi, I'm having trouble with digits. I've added "string.digits" to 'alphabets' at the end where we print using the shift_alphabet function, but nothing happens with the digits, any help?
def caesarCipher(s, k): ans = '' for char in s: if char.isupper(): ans += chr((ord(char)+k-65) % 26+65) elif char.islower(): ans += chr((ord(char)+k-97) % 26+97) else: ans += char return ans s = input().strip() # Input String k = int(input().strip()) # key print(caesarCipher(s, k))
I'm using pycharm it says 'no module named string' , though it seems to be working fine when I tried to import it in Pydroid in my phone. Can anyone help?
I tried pip install but it says ERROR: Could not find a version that satisfies the requirement string (from versions: none) ERROR: No matching distribution found for string
why it's not working: text = input("Enter the text:") cipher = '' for char in text: if not char.isalpha(): continue char = char.upper() code = ord(char) + 1 if char > ord('Z'): code = ord('A')
youtube deleted them because in their opinion videos violated the rules by showing people how to create trojan for example theyre available on patreon where you can see them for 5$ and he doesnt want to share them without possibility of earning money
@@NeuralNine not necessarily happy with the fact that i can no longer watch them for free (or technically free since watching ads is a payment) but imo it's mostly youtube to blame and I also somewhat admire when people are open about the fact that it's business instead of trying to act like they're doing stuff out of goodness of their heart
@@isomane7911 Yeah it sucks. But I can also openly and transparently tell you that I would make more money, more subscribers etc. if it was on TH-cam. I am always for Win / Win situations where the audience can watch everything for free and I can still grow the business. However, the best content (machine learning etc.) will still be on TH-cam for free and the quality will increase over time.
You are so good and the channel is underated ;( you deserve a lot,thc for the content!!!
i wish i deserved a lot of thc for my content
dude.. i advise you to start makin'/workin' on Udemy. i would like to buy a Python course from you!
If you really want to get fancy, you can use "frequency analysis" to decode the message:
Let's assume that the message is in English for this example.
1. Look at the distribution of how often the letters come up.
2. The most common letter in English is the letter E.
3. So, at least if the message is long enough, one of the most common letters in the encrypted message should map to E.
4. So we can get the shift by simply looking at the distance between E and the most common letter, because that would map the most common letter back to E.
Yes true! This is why the Caesar cipher is not really useful in a real scenario.
@@NeuralNine You can make it useful by applying different shifts in different cases. For example, add 7 when i is even and subtract 3 when it's odd. If you make up more complex rules, it would be very difficult if not impossible to brute-force it.
I was just thinking of creating a gui that encrypts a message, when your notification came in
5:31 I particularly don't understand what is going on with the 26-80 thing, I have seen other blog tutorials too where this something is subtracted from 26 in order to get back to the original value from an encrypted value; but I found an easy solution. Just use negative numbers. Put shift = -5 and it will work fine to give the original result back. (But thanks to the tutorial tho)
I'm in 1st year of high school and your videos are so much awesome, amazing, and informative. Love from INDIA❤
You just got yourself a new subscriber 🤠
He is the best python tutorial guy!
A+ tutorials, training products and content creation.
Thank you for what you do! Your films are very interesting and I teach a lot. I have been learning to program in Python for several months, I am currently 12 years old :)
By the way, I come from Poland, so even there it is helpful!
Awesome encription brother.
Thank you soo much.
I just want to point out that you're not actually implementing a "Caesar" cipher. You're using a shift value of 7, so you're actually implementing a ROT-7 cipher. Caesar cipher is specifically when the shift value is 3. All other values of the shift produce rotation ciphers, but not a Caesar cipher.
You don't make sense.Caesar cipher means shifting the letters.It's actually better than original.
@@yes-ls1rf I've always been taught that a shift of 3 letters is a Caesar cipher, which is a special case of the general family of rotation ciphers.
@@_zelatrix While Julius Caesar himself did use a shift of 3 letters, Augustus Caesar only used a shift of one. The shifting of the letters in this way is noted as the Caesar Cipher but can also be noted as a ROT-7 or ROT-5. Neither is technically incorrect. The script itself is a Caesar Cipher as it can be changed to rotate a different amount so it could be 3 it could be 12 etc, so the script isnt a rot-7 cipher he just happens to only demonstrate a shift of 7.
Ok but how do you decrypt it? Could you make a short video telling us how to?
shift it back
@@mrrage2265 basically in encryption you need to + but in decrypt you just need to -
I'm looking forward to more topics on encryption, and digital signatures
when there are comments before anyone has had time to watch the video
hahahaha best community ^^
Super information bro
thanks :)
That was amazing im gonna give you a subscribe for that!
Awesome video bro! I have done a script that makes the same, but I didn't use the string module. I did it "manually" 😂😂
Thanks for the information bro
So many tips such as nesting functions in functions and string methods. Very helpful.
great job pro keep Going : )
Thanks for the video but can you make a decryption video on your latest codes fro caesar cipher, cause im having difficulties decrypting it using python
Can someone tell me where I can learn more about the method used in line 7 of this code.
Seems very useful and I haven't been taught it. :)
Suppose I want to convert the space as well? Or in stead of jumping from w to a, I enter a range of special characters?
You are fire bro
thanks :D
I did this one in C, it was a lot harder
Yeah C is a different level ^^
Now the hard part: learning how it works. Like i get the big picture but if i want to change something on my own im stuck
After coding it myself I saw your video and learned It can be done a lot shorter with your methods, Thank you!
Just one thing - Is it just me or does the shift is limited to 25, and not above it?
try shift %= 26 - that should solve the problem where the shift gets limited to 25 and reverting back to the normal alphabet when the shift is higher than 25
Hello do you use atom or similar ? That 'play' buttons like standalone mode is usefull i see
Thank you for making this video. I found the decryption was fine for string.lowercase but when I tried it with string.printable the results started to get a bit inconsistent. Any ideas?
Is there a function/method that would print all 26 possible shifts?
What about brute_force?
This is how you create a new language
Hello There!
Is there a way to decrypt the encrypted word/sentence?
And is there a way for the user to choose how many shift they want?
I would appreciate if anyone can answer me!
That's was cool.
Thank you !
Thanks ;)
thanks for watching :)
What program do you use in this video?
i do not understand line 9 to 12. Can anyone explain these lines for me pls?
Hi, I'm having trouble with digits. I've added "string.digits" to 'alphabets' at the end where we print using the shift_alphabet function, but nothing happens with the digits, any help?
But what is the "string"?
please zoom in your videos it is really hard to see
def caesarCipher(s, k):
ans = ''
for char in s:
if char.isupper(): ans += chr((ord(char)+k-65) % 26+65)
elif char.islower(): ans += chr((ord(char)+k-97) % 26+97)
else: ans += char
return ans
s = input().strip() # Input String
k = int(input().strip()) # key
print(caesarCipher(s, k))
finally :D
More is coming! :)
I'm using pycharm it says 'no module named string' , though it seems to be working fine when I tried to import it in Pydroid in my phone. Can anyone help?
I tried pip install but it says
ERROR: Could not find a version that satisfies the requirement string (from versions: none) ERROR: No matching distribution found for string
There seems to be a _string tho
why it's not working:
text = input("Enter the text:")
cipher = ''
for char in text:
if not char.isalpha():
continue
char = char.upper()
code = ord(char) + 1
if char > ord('Z'):
code = ord('A')
cipher = chr(code)
print(cipher)
Do you find solution ? I have maybe some clue
can you build a vigenere encryption pleaseeee
shifted_alphabet is not defined
can you gave me the code
luv u
^^
Can u do a video about what’s on the dark web cause my bro got hacked on it
no more videos of that kind on this channel. Take a look at my Twitter statement.
Yea I'm 2nd
:D
HA HA, when you suddenly realise that POW
شفرة قيصر
This gay can hack NASA using his mind
I think you meant `guy`
Why have you removed your trojan making video. 😭😭😭
Bring it back plzzz🙏🙏🙏🙏
youtube deleted them because in their opinion videos violated the rules by showing people how to create trojan for example
theyre available on patreon where you can see them for 5$ and he doesnt want to share them without possibility of earning money
@@isomane7911 good summary. Full explanation on Twitter
@@NeuralNine not necessarily happy with the fact that i can no longer watch them for free (or technically free since watching ads is a payment) but imo it's mostly youtube to blame and I also somewhat admire when people are open about the fact that it's business instead of trying to act like they're doing stuff out of goodness of their heart
@@isomane7911 Yeah it sucks. But I can also openly and transparently tell you that I would make more money, more subscribers etc. if it was on TH-cam. I am always for Win / Win situations where the audience can watch everything for free and I can still grow the business. However, the best content (machine learning etc.) will still be on TH-cam for free and the quality will increase over time.
I was going to study that after my exams, too bad it's removed...🥺
Why doesn't it shift the punctuations and numbers for me?
import string
def caesar(text,shift,alphabets):
'''Algorithm to encrypt password'''
global shifted_alphabets,table,final_shifted_alphabets, final_alphabets
def shift_alphabets(alphabets):
return alphabets[shift:] + alphabets[:shift]
shifted_alphabets = tuple(map(shift_alphabets, alphabets))
final_alphabets = ''.join(alphabets)
final_shifted_alphabets = ''.join(shifted_alphabets)
table = str.maketrans(final_alphabets, final_shifted_alphabets)
return text.translate(table)
plain_text = "This is a new test..."
shift_interval = 7
encrypt = caesar(plain_text,shift_interval ,[string.ascii_lowercase, string.ascii_uppercase, string.punctuation])
print(encrypt)
decrypt = caesar(encrypt,26-shift_interval ,[string.ascii_lowercase, string.ascii_uppercase, string.punctuation])
print(decrypt)