11<!DOCTYPE html>
22< html >
3- < head >
4- < title > Encryption</ title >
5- < style >
6- body {
7- position : absolute;
8- width : 100% ;
9- height : 100% ;
10- top : 0px ;
11- left : 0px ;
12- padding : 0px ;
13- margin : 0px ;
14- font-size : 16px ;
15- font-family : helvetica;
16- cursor : default;
17- overflow : auto;
18- min-width : 250px ;
19- min-height : 250px ;
20- color : rgb (234 , 234 , 234 );
21- background-color : rgb (33 , 33 , 33 );
22- line-height : 20px ;
23- }
24- .decrypted , .encrypted {
25- width : 50% ;
26- height : 100% ;
27- float : left;
28- }
29- h2 {
30- display : block;
31- width : 100% ;
32- height : 50px ;
33- line-height : 50px ;
34- font-size : 25px ;
35- margin : 0px ;
36- padding : 0px ;
37- text-align : center;
38- }
39- button {
40- display : block;
41- width : 100% ;
42- height : 50px ;
43- line-height : 50px ;
44- font-size : 25px ;
45- font-weight : normal;
46- text-transform : uppercase;
47- outline : none;
48- border : none;
49- border-color : yellow;
50- margin : 0px ;
51- padding : 0px ;
52- cursor : pointer;
53- background-color : rgb (50 , 50 , 50 );
54- color : rgb (200 , 200 , 200 );
55- transition : background-color ease-out 0.2s ;
56- }
57- button : hover {
58- background-color : rgb (75 , 75 , 75 );
59- }
60- textarea {
61- display : block;
62- width : 821px ;
63- height : 373px ;
64- outline : currentcolor none medium;
65- border : medium none;
66- margin : 0px ;
67- padding : 0px ;
68- background-color : transparent;
69- color : rgb (200 , 200 , 200 );
70- font-size : 16px ;
71- font-family : consolas;
72- line-height : 16px ;
73- overflow : auto;
74- max-height : calc (100% - 100px );
75- min-height : calc (100% - 100px );
76- max-width : 100% ;
77- min-width : 100% ;
78- box-sizing : border-box;
79- padding : 5px ;
80- resize : none;
81- }
82- </ style >
83- < script >
84- function encrypt ( ) {
85- var text = document . querySelector ( '.decrypted textarea' ) . value ;
86- var result = document . querySelector ( '.encrypted textarea' ) ;
87- var key = prompt ( 'Enter the encryption key:' , '' ) ;
88- var cursor = 0 ;
89- var output = '' ;
90- if ( key !== null ) {
91- if ( key != '' ) {
92- for ( var i = 0 ; i < text . length ; i ++ ) {
93- if ( cursor > ( key . length - 1 ) ) { cursor = 0 ; }
94- output += text [ i ] . charCodeAt ( 0 ) + key [ cursor ] . charCodeAt ( 0 ) ;
95- if ( i != ( text . length - 1 ) ) { output += ' ' ; }
96- cursor ++ ;
97- }
98- result . value = output ;
99- alert ( 'Done!' ) ;
100- } else {
101- alert ( 'Please, enter the encryption key!' ) ;
3+
4+ < head >
5+ < title > Encryption</ title >
6+ < style >
7+ body {
8+ position : absolute;
9+ width : 100% ;
10+ height : 100% ;
11+ top : 0px ;
12+ left : 0px ;
13+ padding : 0px ;
14+ margin : 0px ;
15+ font-size : 16px ;
16+ font-family : helvetica;
17+ cursor : default;
18+ overflow : auto;
19+ min-width : 250px ;
20+ min-height : 250px ;
21+ color : rgb (234 , 234 , 234 );
22+ background-color : rgb (33 , 33 , 33 );
23+ line-height : 20px ;
24+ }
25+
26+ .decrypted ,
27+ .encrypted {
28+ width : 50% ;
29+ height : 100% ;
30+ float : left;
31+ }
32+
33+ h2 {
34+ display : block;
35+ width : 100% ;
36+ height : 50px ;
37+ line-height : 50px ;
38+ font-size : 25px ;
39+ margin : 0px ;
40+ padding : 0px ;
41+ text-align : center;
42+ }
43+
44+ button {
45+ display : block;
46+ width : 100% ;
47+ height : 50px ;
48+ line-height : 50px ;
49+ font-size : 25px ;
50+ font-weight : normal;
51+ text-transform : uppercase;
52+ outline : none;
53+ border : none;
54+ border-color : yellow;
55+ margin : 0px ;
56+ padding : 0px ;
57+ cursor : pointer;
58+ background-color : rgb (50 , 50 , 50 );
59+ color : rgb (200 , 200 , 200 );
60+ transition : background-color ease-out 0.2s ;
61+ }
62+
63+ button : hover {
64+ background-color : rgb (75 , 75 , 75 );
65+ }
66+
67+ textarea {
68+ display : block;
69+ width : 821px ;
70+ height : 373px ;
71+ outline : currentcolor none medium;
72+ border : medium none;
73+ margin : 0px ;
74+ padding : 0px ;
75+ background-color : transparent;
76+ color : rgb (200 , 200 , 200 );
77+ font-size : 16px ;
78+ font-family : consolas;
79+ line-height : 16px ;
80+ overflow : auto;
81+ max-height : calc (100% - 100px );
82+ min-height : calc (100% - 100px );
83+ max-width : 100% ;
84+ min-width : 100% ;
85+ box-sizing : border-box;
86+ padding : 5px ;
87+ resize : none;
88+ }
89+ </ style >
90+ < script >
91+ function encrypt ( ) {
92+ var text = document . querySelector ( '.decrypted textarea' ) . value ;
93+ var result = document . querySelector ( '.encrypted textarea' ) ;
94+ var key = prompt ( 'Enter the encryption key:' , '' ) ;
95+ var cursor = 0 ;
96+ var output = '' ;
97+ if ( key !== null ) {
98+ if ( key != '' ) {
99+ for ( var i = 0 ; i < text . length ; i ++ ) {
100+ if ( cursor > ( key . length - 1 ) ) { cursor = 0 ; }
101+ output += text [ i ] . charCodeAt ( 0 ) + key [ cursor ] . charCodeAt ( 0 ) ;
102+ if ( i != ( text . length - 1 ) ) { output += ' ' ; }
103+ cursor ++ ;
102104}
105+ result . value = output ;
106+ alert ( 'Done!' ) ;
107+ } else {
108+ alert ( 'Please, enter the encryption key!' ) ;
103109}
104110}
105- function decrypt ( ) {
106- var text = document . querySelector ( '.encrypted textarea' ) . value . split ( ' ' ) ;
107- var result = document . querySelector ( '.decrypted textarea' ) ;
108- var key = prompt ( 'Enter the decryption key:' , '' ) ;
109- var cursor = 0 ;
110- var output = '' ;
111- if ( key !== null ) {
112- if ( key != '' ) {
113- for ( var i = 0 ; i < text . length ; i ++ ) {
114- if ( cursor > ( key . length - 1 ) ) { cursor = 0 ; }
115- output += String . fromCharCode ( Math . abs ( text [ i ] - key [ cursor ] . charCodeAt ( 0 ) ) ) ;
116- cursor ++ ;
117- }
118- result . value = output ;
119- alert ( 'Done!' ) ;
120- } else {
121- alert ( 'Please, enter the decryption key!' ) ;
111+ }
112+ function decrypt ( ) {
113+ var text = document . querySelector ( '.encrypted textarea' ) . value . split ( ' ' ) ;
114+ var result = document . querySelector ( '.decrypted textarea' ) ;
115+ var key = prompt ( 'Enter the decryption key:' , '' ) ;
116+ var cursor = 0 ;
117+ var output = '' ;
118+ if ( key !== null ) {
119+ if ( key != '' ) {
120+ for ( var i = 0 ; i < text . length ; i ++ ) {
121+ if ( cursor > ( key . length - 1 ) ) { cursor = 0 ; }
122+ output += String . fromCharCode ( Math . abs ( text [ i ] - key [ cursor ] . charCodeAt ( 0 ) ) ) ;
123+ cursor ++ ;
122124}
125+ result . value = output ;
126+ alert ( 'Done!' ) ;
127+ } else {
128+ alert ( 'Please, enter the decryption key!' ) ;
123129}
124130}
125- </ script >
126- </ head >
127- < body >
128- < div class ="decrypted ">
129- < h2 > Decrypted</ h2 >
130- < textarea id ="kek " placeholder ="Some text... "> </ textarea >
131- < button onclick ="encrypt(); "> Encrypt</ button >
132- </ div >
133- < div class ="encrypted ">
134- < h2 > Encrypted</ h2 >
135- < textarea placeholder ="97 18 44... "> </ textarea >
136- < button onclick ="decrypt(); "> Decrypt</ button >
137- </ div >
138- < div style ="clear: both; "> </ div >
139- </ body >
131+ }
132+ </ script >
133+ </ head >
134+
135+ < body >
136+ < div class ="decrypted ">
137+ < h2 > Decrypted</ h2 >
138+ < textarea id ="kek " placeholder ="Some text... "> </ textarea >
139+ < button onclick ="encrypt(); "> Encrypt</ button >
140+ </ div >
141+ < div class ="encrypted ">
142+ < h2 > Encrypted</ h2 >
143+ < textarea placeholder ="97 18 44... "> </ textarea >
144+ < button onclick ="decrypt(); "> Decrypt</ button >
145+ </ div >
146+ < div style ="clear: both; "> </ div >
147+ </ body >
148+
140149</ html >
0 commit comments