본문 바로가기
Programming/Perl

pl- 시저의 암호

by NAMP 2009. 5. 16.

평   문

a

b

c

d

e

f

g

h

i

j

k

l

m

n

o

p

q

r

s

t

u

v

w

x

y

z

암호문

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

A

B

C


다음과 같이 암호화를 하면 된다.

use strict;
use warnings;

my @alphabet=(a..z);
my $diff=3;

foreach (split//,<>){
my $word=$_;
my $i=0;
foreach(@alphabet){
print $alphabet[($i+$diff)%26] if $_ eq $word;
$i++;
}
}

암호화만,,,,,,,,,,
해독은.............음.........어떻게 하지...

'Programming > Perl' 카테고리의 다른 글

[Perl] SQL 스크립트에서 대상 정보 추출  (0) 2014.12.07
The 2008 Winter Scripting Games / Beginner Event 1: Pairing Off  (0) 2009.05.23
Perl Underground 2  (0) 2009.05.02
perl underground 1-3  (0) 2009.05.02
perl underground 1-2  (0) 2009.05.01

댓글