bungatepijalan Moe Princess
Posts : 1487 Thanked : 30 Engine : Multi-Engine User Skill : Intermediate Type : Developer
Trophies
Awards: | Subyek: [GM8-GML] RSA Algorithm 2010-09-26, 11:41 | |
| - Overview:
Ga mau dan takut kalo file game save-nya dihack? Butuh cara & algoritma enkripsi yang paling ampuh dan terjamin aman? RSA Algorithm is the answer!
Script: modX - Code:
-
//modX(a,b,p) : power(a,b) mod p if(argument1<=2){ return power(argument0,argument1) mod argument2; }else if(argument1 mod 2==0){ return (modX(argument0,argument1/2,argument2)*modX(argument0,argument1/2,argument2)) mod argument2 }else{ return (modX(argument0,argument1-1,argument2)*modX(argument0,1,argument2)) mod argument2 } Script: generatePublicKeys - Code:
-
//generatePublicKeys(e) //where e is a public key that is relatively prime to m a=23 b=11 global.n=a*b global.m=(a-1)*(b-1) global.e=argument0 k=1 while((1+k*global.m) mod global.e<>0){ k+=1 } global.d=(1+k*global.m)/global.e Script: encrypt - Code:
-
//encrypt(input_file,output_file) fileid=file_bin_open(argument0,0) fileido=file_bin_open(argument1,1) file_bin_rewrite(fileido) if(file_bin_size(fileid) mod 2 !=0){ ba=file_bin_read_byte(fileid) file_bin_write_byte(fileido,~ba) } do{ ba=file_bin_read_byte(fileid) bb=file_bin_read_byte(fileid) bc=ba mod 16 ba=(ba div 16)*16+bb div 16 bb=bc*16+bb mod 16 ba=modX(ba,global.e,global.n) bb=modX(bb,global.e,global.n) file_bin_write_byte(fileido,ba) file_bin_write_byte(fileido,bb) }until (file_bin_position(fileid)>file_bin_size(fileid)-1) file_bin_close(fileid) file_bin_close(fileido) Script: decrypt - Code:
-
//decrypt(input_file,output_file) fileid=file_bin_open(argument0,0) fileido=file_bin_open(argument1,1) file_bin_rewrite(fileido) if(file_bin_size(fileid) mod 2 !=0){ ba=file_bin_read_byte(fileid) file_bin_write_byte(fileido,~ba) } do{ ba=file_bin_read_byte(fileid) bb=file_bin_read_byte(fileid) ba=modX(ba,global.d,global.n) bb=modX(bb,global.d,global.n) bc=ba mod 16 ba=(ba div 16)*16+bb div 16 bb=bc*16+bb mod 16 file_bin_write_byte(fileido,ba) file_bin_write_byte(fileido,bb) }until (file_bin_position(fileid)>file_bin_size(fileid)-1) file_bin_close(fileid) file_bin_close(fileido) Fungsi: mengenkripsi & mendekripsi data ke/dari suatu file input, termasuk utk save game & load game
Cara pemasangan: - Buat empat script baru, kasi nama modX, generatePublicKeys, encrypt dan decrypt - Copas masing-masing bagian code di atas ke masing2 script tersebut - Implementasikan script-script tersebut (kecuali modX) ke action Execute a piece of code seperti contoh di berikut ini (tergantung penggunaan file). Untuk fungsi generatePublicKeys, masukkan suatu nilai kunci publik e dengan syarat e harus relatif prima terhadap m (FPB dari e dan m sama dengan 1).
Implementasi Contoh: Misalkan sebuah file terenkripsi bernama f.txt didekripsi dengan file keluaran bernama g.txt, dan isi file g.txt akan ditampung dalam string ss (yang nantinya ditampilkan). Setelah selesai, g.txt akan dihapus untuk menjaga kerahasiaan. Maka di bagian actions tambahkan action Execute a piece of code, dan isi dengan kode sebagai berikut: - Code:
-
generatePublicKeys(19) //if(file_exists("e.txt"))encrypt("e.txt","f.txt") decrypt("f.txt","g.txt") ss="" fileid=file_bin_open("g.txt",0) do{ ba=file_bin_read_byte(fileid) ss+=chr(ba) }until (file_bin_position(fileid)>file_bin_size(fileid)-1) file_bin_close(fileid) file_delete("g.txt") Di sini kita gunakan kunci public e=19. Sebagai langkah awal, kita buat enkripsi dari file teks yang bernama e.txt, dengan menghilangkan komen pada kode di atas (baris kedua).
Guarantee: Dijamin 99,9% aman dan super too difficult to hack!!!
Created by: Bunga Tepi Jalan
Credits - http://en.wikipedia.org/wiki/RSA - http://www.givemethecode.com
NB: Lihat konsep dan prinsip Algoritma RSA di: http://prodig.forumotion.net/programming-f28/programming-cryptography-rsa-algorithm-t74.htm
Terakhir diubah oleh bungatepijalan tanggal 2010-10-01, 21:04, total 5 kali diubah (Reason for editing : kode sudah dibuat XD) | |
|
bungatepijalan Moe Princess
Posts : 1487 Thanked : 30 Engine : Multi-Engine User Skill : Intermediate Type : Developer
Trophies
Awards: | |
KID_VX Senior
Posts : 959 Thanked : 24 Engine : Multi-Engine User Skill : Very Beginner Type : Developer
| Subyek: Re: [GM8-GML] RSA Algorithm 2010-09-29, 20:50 | |
| Keren banget, sayang wa bukan pengguna GM | |
|
Vsio Xutix Xox
Posts : 2377 Thanked : 18 Engine : Multi-Engine User Skill : Advanced Type : Developer
| Subyek: Re: [GM8-GML] RSA Algorithm 2010-09-29, 21:03 | |
| | |
|
bungatepijalan Moe Princess
Posts : 1487 Thanked : 30 Engine : Multi-Engine User Skill : Intermediate Type : Developer
Trophies
Awards: | Subyek: Re: [GM8-GML] RSA Algorithm 2010-09-29, 21:17 | |
| | |
|
KID_VX Senior
Posts : 959 Thanked : 24 Engine : Multi-Engine User Skill : Very Beginner Type : Developer
| Subyek: Re: [GM8-GML] RSA Algorithm 2010-09-30, 16:00 | |
| btw filenya slain di encrypt, di compress juga ga? :cupu: | |
|
bungatepijalan Moe Princess
Posts : 1487 Thanked : 30 Engine : Multi-Engine User Skill : Intermediate Type : Developer
Trophies
Awards: | |
hyperkudit Pahlawan Super
Posts : 2288 Thanked : 30 Engine : RMXP Skill : Very Beginner Type : Artist
Trophies
Awards:
| Subyek: Re: [GM8-GML] RSA Algorithm 2010-10-01, 12:05 | |
| wew... keren kayaknya... tapi sayang saya bukan pengguna GM.. bisa bikinin hackshield buat rmxp?? | |
|
bungatepijalan Moe Princess
Posts : 1487 Thanked : 30 Engine : Multi-Engine User Skill : Intermediate Type : Developer
Trophies
Awards: | |
Rei_Fan49 Ex-Scripter
Posts : 304 Thanked : 15 Engine : Multi-Engine User Skill : Advanced Type : Scripter
| Subyek: Re: [GM8-GML] RSA Algorithm 2010-10-19, 15:49 | |
| @bunga: anyway ini script buatan km sendiri? kalo iya, minta ijin buat rubah ke ruby. (Marshal masih bisa dihack sama aku soalnya ) (kalo dibolehin, ntar aku post scriptnya.. soalnya udah jadi) | |
|
Sponsored content
| Subyek: Re: [GM8-GML] RSA Algorithm | |
| |
|