Cov txheej txheem:
- Khoom siv
- Kauj Ruam 1: Tshaj Tawm Cov Hloov Pauv thiab Tau Txais Cov Lus Qhia
- Kauj Ruam 2: Tsim Tus Kheej Tshiab
- Kauj Ruam 3: Hloov Cov Lus
- Kauj ruam 4: Ntxiv
Video: Caesar Cipher Program hauv Python: 4 Cov Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:24
Caesar Cipher yog lub qub thiab siv dav cipher uas yooj yim rau encrypt thiab decrypt. Nws ua haujlwm los ntawm kev hloov cov tsiaj ntawv ntawm cov tsiaj ntawv los tsim cov tsiaj ntawv tshiab (ABCDEF tuaj yeem hloov pauv ntau dua 4 tus ntawv thiab yuav dhau los ua EFGHIJ).
Caesar Ciphers tsis yog tus ciphers ruaj ntseg tshaj plaws nyob ntawd tab sis zoo rau cov haujlwm me me xws li hla cov ntawv zais lossis ua tus lej zais me ntsis muaj zog. Nws yog qhov yooj yim heev rau kev txiav txim siab tus lej, tab sis nws tuaj yeem ua rau nyuaj rau encrypt ib qho yog tias koj tsis muaj cov tsiaj ntawv tshwj xeeb cim.
Txhawm rau ua cov txheej txheem no yooj yim dua, peb tuaj yeem siv lub zog ntawm cov khoos phis tawj, tshwj xeeb tshaj yog cov lus programming Python.
Cov Lus Qhia no yuav qhia koj yuav ua li cas tsim ib qho program uas hloov cov lus mus rau hauv tus lej ntawm koj cov lus txib.
Khoom siv
Txhua yam koj xav tau yog tus neeg txhais lus nab nab: IDLE, Pycharm, thiab Thonny yog qee qhov zoo, xaiv dawb (Kuv siv Pycharm)
Kev paub pib ntawm Python
Kauj Ruam 1: Tshaj Tawm Cov Hloov Pauv thiab Tau Txais Cov Lus Qhia
Txhawm rau khaws cov hlua (ntawv) qhov tseem ceeb ntawm tus niam ntawv, xov, hloov pauv, thiab lwm yam peb yuav tsum siv cov lej sib txawv. Peb pib los ntawm kev tshaj tawm qhov hloov pauv 'cov tsiaj ntawv', 'partialOne', 'partialTwo', thiab 'newAlphabet'. Kuv tau sau cov npe ntawm qhov hloov pauv hauv Camel Case hauv kuv tus lej (thawj lo lus yog tus ntawv me thiab tus ntawv thib ob) tab sis koj tuaj yeem sau nws txhua txoj kev uas koj xav tau, tsuav koj nco ntsoov hloov nws thoob plaws qhov seem ntawm tus lej ib yam. Cov tsiaj ntawv sib txawv muaj nuj nqis "abcdefghijklmnopqrstuvwxyz". Tag nrho lwm qhov kev hloov pauv tau teeb tsa rau "", uas yog txoj hlua khoob vim peb tseem tsis tau muaj lawv qhov txiaj ntsig.
Qhov no tau ua dab tsi yog teeb tsa Cov Txheej Txheem Ib Feem, uas yog yam peb tab tom siv los tsim qhov hloov pauv. Qhov no yuav piav qhia hauv qib tom ntej.
Tom qab qhov no, peb yuav tsum tau txais cov lus thiab hloov tus nqi los ntawm tus neeg siv. Peb siv cov tswv yim ua haujlwm los ua qhov no. Ib feem ntawm txoj cai nug tus neeg siv cov lus thiab tus lej kom hloov cov tsiaj ntawv los ntawm.
CODE:
niam ntawv = "abcdefghijklmnopqrstuvwxyz"
partialOne = "ib"
partialTwo = ""
newAlphabet = ""
message = input ("Thov sau cov lus koj xav txhais:").lower ()
key = int (input ("Thov sau tus lej koj xav hloov los ntawm:"))
Kauj Ruam 2: Tsim Tus Kheej Tshiab
Tam sim no los tsim cov ntawv hloov pauv. Txhawm rau ua qhov no, peb yuav siv cov txheej txheem ib nrab. Cov kab ke ib nrab yog qhov uas lub khoos phis tawj muab cov tsiaj ntawv faib ua ob ntu (txoj hauv kev zoo los hais ib feem). Thawj ib nrab yog ntev npaum li cas koj tau hais qhia txoj haujlwm kom txav mus los, thiab qhov thib ob yog qhov seem. Lub computer hloov pauv ib feem. Qhov ntawd yog qhov ua raws txoj cai, nrog rau thawj nqe lus, uas hais tias yog tias qhov hloov pauv yog 0, cov tsiaj ntawv tshiab thiab cov tsiaj ntawv qub zoo ib yam vim tias koj tsis hloov dab tsi.
Piv txwv li:
Cov duab - 123456789
Ib Feem Ib - 123; Ib nrab Ob - 456789
Sequence Tshiab - 456789123
CODE:
yog qhov tseem ceeb == 0:
newAlphabet = niam ntawv
elif qhov tseem ceeb> 0:
partialOne = niam ntawv [: key]
partialTwo = cov tsiaj ntawv [qhov tseem ceeb:]
newAlphabet = partialTwo + partialOne
lwm tus:
partialOne = niam ntawv [:(26 + qhov tseem ceeb)]
partialTwo = niam ntawv [(26 + qhov tseem ceeb):]
newAlphabet = partialTwo + partialOne
Kauj Ruam 3: Hloov Cov Lus
Tam sim no peb muaj peb tus niam ntawv thiab tus niam ntawv tshiab. Txhua yam uas tshuav yog hloov cov lus rau hauv txoj cai.
Ua ntej, peb teeb tsa qhov hloov pauv tshiab thiab hu nws 'encrypted' thiab teeb nws rau "". Tom qab ntawd peb sau qhov nyuaj rau lub voj uas txheeb xyuas txhua tsab ntawv hauv kab lus thiab hloov nws mus rau tsab ntawv tshiab. Nws tso tawm qhov tshwm sim thiab muaj koj muaj nws, ua tiav txoj cai hloov pauv!
CODE:
encrypted = "" rau message_index hauv ntau (0, len (lus)):
yog message [message_index] == "":
encrypted+= ""
rau cov niam ntawv_index hauv ntau (0, len (newAlphabet)):
yog cov lus [message_index] == cov tsiaj ntawv [alphabet_index]:
encrypted+= newAlphabet [cov tsiaj ntawv_index]
luam (encrypted)
Kauj ruam 4: Ntxiv
Txuas nrog yog cov ntaub ntawv code.
Pom zoo:
Tuchless Hloov rau Cov Khoom Siv Hauv Tsev -- Tswj Koj Cov Khoom Siv Hauv Tsev Tsis Muaj Tuch Ib qho Hloov: 4 Cov Kauj Ruam
Tuchless Hloov rau Cov Khoom Siv Hauv Tsev || Tswj Koj Cov Khoom Siv Hauv Tsev Tsis Muaj Tuch Ib qho Hloov: Nov Yog Qhov Tuchless Hloov Rau Cov Khoom Siv Hauv Tsev. Koj Siv Tau Qhov No Mus Rau Txhua Qhov Chaw Hauv Pej Xeem Kom Pab Tau Tawm Tsam Ib Yam Kab Mob. Lub Circuit Court Raws Li Tsaus Sensor Circuit Ua Los Ntawm Op-Amp Thiab LDR. Qhov Tseem Ceeb Thib Ob Ntawm Qhov Circuit Court SR Flip-Flop Nrog Sequencell
Yooj Yim Cov Chaw Siv Cov Ntaub Ntawv Hauv Chaw Siv Hauv / Arduino / PfodApp: 6 Cov Kauj Ruam
Yooj Yim Cov Ntaub Ntawv Tseem Ceeb Siv Hauv Hauv/Arduino/PfodApp: Rau Plotting Cov Ntaub Ntawv tawm tsam Hnub/Sijhawm siv tsuas yog Arduino's millis () pom qhov qhia no Android mobile thiab ntes nws rau
Cov Tub Rog Sib Ntaus Hauv Naval hauv UM-JI: 14 Cov Kauj Ruam (nrog Duab)
Naval Battle Robot in UM-JI: Taw qhia rau tus neeg hlau Hauv phau ntawv qhia no, koj yuav raug qhia paub yuav ua li cas thiaj ua tus neeg hlau sib ntaus sib tua hauv nkoj nrog PS2 tus tswj. Raws li pab pawg X rau VG100 chav kawm, chav kawm tsim los rau cov tub ntxhais kawm qib siab lub hom phiaj ntawm kev tsim kho lub peev xwm ntawm kev tsim qauv thiab kev koom tes, ntawm
Kev Nkag Mus Rau Cov Hauv Paus Cov Hauv Paus Cov Ntaub Ntawv Siv DB410 Raws Li Ethernet Dongle: 6 Cov Kauj Ruam
Kev Nkag Mus Rau Cov Hauv Paus Cov Hauv Paus Cov Ntaub Ntawv Siv DB410 Raws Li Ethernet Dongle: Lub Hom Phiaj: Txhim kho cov cuab yeej cuab tam thiab rov ua dua cov ntsiav kom ntxig USB Ethernet CDC Gadget txhawb nqa; Rov tsim boot.img los ntawm Linaro rau khau raj USB Ethernet CDC; Tsim NFS server los tuav lub hauv paus cov ntaub ntawv system; IP teeb tsa hauv DEVICE thiab HOST
Cov cuab yeej cuab tam - Ceramic hauv Cov Ntsiab Lus ntawm Cov Txheej Txheem Digital thiab Analog 2015: 3 Cov Kauj Ruam (nrog Duab)
Cov cuab yeej cuab tam - Ceramic hauv Cov Ntsiab Lus ntawm Digital thiab Analog Cov Txheej Txheem 2015: Txog tam sim no, cov khoom siv hlau yog cov khoom siv tes ua uas tsis muaj kev cuam tshuam digital. Vim li no, nws zoo siab heev los ua phooj ywg nrog cov cuab yeej tshiab. Lub hauv paus pib yog daim ntawv qub thiab CNC Styrocutter.DESIGNBOOM