March 04, 2021, 10:19:38 PM
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Forum
Help
Search
Gallery
Login
Register
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
File Utilities
»
[bb] Simple Encrypter/Decrypter by Rob Farley [ 1+ years ago ]
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: [bb] Simple Encrypter/Decrypter by Rob Farley [ 1+ years ago ] (Read 1230 times)
BlitzBot
Jr. Member
Posts: 1
[bb] Simple Encrypter/Decrypter by Rob Farley [ 1+ years ago ]
«
on:
June 29, 2017, 12:28:42 AM »
Title :
Simple Encrypter/Decrypter
Author :
Rob Farley
Posted :
1+ years ago
Description :
Okay, this isn't high security or anything like that, however, if you've got files that place objects, save high scores etc and you don't want people monkeying around with them this should be enough to put someone off.
Simply set the input file and output file and it does the rest.
have fun!
Code :
Code: BlitzBasic
; ===================================================================================================
; Simple encrypter/decrypter
; 2003 Mental Illusion
; http://www.mentalillusion.co.uk
; rob@mentalillusion.co.uk
; ===================================================================================================
; I know this isn't high security or anything, but it's enough to make people not bother!
; Usage
; encrypt(Input file, output file, random seed)
; decrypt(Input file, output file)
encrypt
(
"test.txt"
,
"encrypted.txt"
,
1
)
decrypt
(
"encrypted.txt"
,
"decrypted.txt"
)
End
Function
encrypt
(
input_file$,output_file$,seed
)
SeedRnd
seed
filein =
ReadFile
(
input_file
)
fileout =
WriteFile
(
output_file
)
WriteString
(
fileout,seed
)
While
Not
Eof
(
filein
)
temp$=
ReadLine
(
filein
)
enc$=
""
For
n=
1
To
Len
(
temp$
)
t=
Asc
(
Mid
(
temp,n,
1
)
)
t=t+
Rand
(
1
,
Rand
(
1
,
128
)
)
If
t>
255
Then
t=t-
255
enc=enc+
Chr
$
(
t
)
Next
WriteLine
(
fileout,enc$
)
Wend
CloseFile
(
filein
)
CloseFile
(
fileout
)
End Function
Function
decrypt
(
input_file$,output_file$
)
filein =
ReadFile
(
input_file
)
fileout =
WriteFile
(
output_file
)
seed=
ReadString
(
filein
)
SeedRnd
seed
While
Not
Eof
(
filein
)
temp$=
ReadLine
(
filein
)
enc$=
""
For
n=
1
To
Len
(
temp$
)
t=
Asc
(
Mid
(
temp,n,
1
)
)
t=t-
Rand
(
1
,
Rand
(
1
,
128
)
)
If
t<
0
Then
t=t+
255
enc=enc+
Chr
$
(
t
)
Next
WriteLine
(
fileout,enc$
)
Wend
CloseFile
(
filein
)
CloseFile
(
fileout
)
End Function
Comments :
Blitz123(Posted 1+ years ago)
This could also be used for secret programing comunications.....
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
File Utilities
»
[bb] Simple Encrypter/Decrypter by Rob Farley [ 1+ years ago ]
SimplePortal 2.3.6 © 2008-2014, SimplePortal