OO CIPHER
Lastest version: 0.5 by Code34
Description
OO Cipher is a class (object oriented) that permits to cipher and uncipher strings. OO_Cipher is compatible with LUCIFER command line tools that permits to cipher and uncipher files.
Like to Donate ? Donate with paypal
Github: https://github.com/code34/oo_cipher.altis
Download: https://github.com/code34/oo_cipher.altis/archive/master.zip
Reference: http://forums.bistudio.com/showthread.php?167980-Object-Oriented-SQF-Scripting-and-Compiling
Additionnal link: RC34 procedural version with MIT licence
Features:
- Cipher/Uncipher with Rivest Cipher 4 algorythm
Licence:
Under Gpl, you can share, modify, distribute this script but don't remove the licence and the name of the original author
Documentation:
/*
Author: code34 nicolas_boiteux@yahoo.fr
Copyright (C) 2017-2018 Nicolas BOITEUX
CLASS OO_CIPHER
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
Function:
_cipher = "new" call OO_CIPHER;
Create a new cipher object
*/
/*
Function : ["cipher", ["key", "data"]] call _cipher;
cipher or uncipher a string with RC4 algorithme
@key is the string of your private key
@data is the string to cipher / uncipher
@return an ciphered hexadecimal string
*/
/*
Function : ["uncipher", ["key", "data"]] call _cipher;
cipher or uncipher a string with RC4 algorithme
@key is the string of your private key
@data is a cephired hexadecimal string
@return a deciphered hexadecimal string
*/
Readme:
/*
Author: code34 nicolas_boiteux@yahoo.fr
Copyright (C) 2017-2018 Nicolas BOITEUX
CLASS OO_CIPHER OBJECT
RC4 reference:
https://fr.wikipedia.org/wiki/RC4
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
Create a cipher object
Usage:
put the "oo_cipher.sqf" and the "oop.h" files in your mission directory
put this code into your mission init.sqf
call compilefinal preprocessFileLineNumbers "oo_cipher.sqf";
See example mission in directory: init.sqf
Licence:
You can share, modify, distribute this script but don't remove the licence and the name of the original author
logs:
0.4 - re factory, add uncipher method
0.3 - add 2048bits key - fix typo
0.2 - add hexa convertion functions
0.1 - OO CIPHER - first release with Rivest Cipher 4
Examples
call compilefinal preprocessFileLineNumbers "oo_cipher.sqf";
sleep 1;
private _cipher = "new" call OO_CIPHER;
private _key = "WilliamShakespeare";
private _data = "To be, or not to be: that is the question:
Whether 'tis nobler in the mind to suffer
The slings and arrows of outrageous fortune,
Or to take arms against a sea of troubles,
And by opposing end them. To die: to sleep;
No more; and by a sleep to say we end
The heart-ache, and the thousand natural shocks
That flesh is heir to, 'tis a consummation
Devoutly to be wish'd. To die, to sleep;
To sleep: perchance to dream: aye, there's the rub;
For in that sleep of death what dreams may come,
When we have shuffled off this mortal coil,
Must give us pause: there's the respect
That makes calamity of so long life;
For who would bear the whips and scorns of time,
The oppressor's wrong, the proud man's contumely,
The pangs of despised love, the law's delay,
The insolence of office, and the spurns
That patient merit of the unworthy takes,
When he himself might his quietus make
With a bare bodkin? who would fardels bear,
To grunt and sweat under a weary life,
But that the dread of something after death,
The undiscover'd country from whose bourn
No traveler returns, puzzles the will,
And makes us rather bear those ills we have
Than fly to others that we know not of?
Thus conscience does make cowards of us all,
And thus the native hue of resolution
Is sicklied o'er with the pale cast of thought,
And enterprises of great pith and moment
With this regard their currents turn awry
And lose the name of action.";
hint format ["original data: %1", _data];
sleep 2;
_data = ["cipher",[_key, _data]] call _cipher;
hint format ["Hexa Cipher data with RC4: %1", _data];
sleep 2;
_data = ["uncipher",[_key, _data]] call _cipher;
hint format ["uncipher data: %1", _data];
Example of William Shakespeare after been ciphered
0044213A5C6867B4B2D8C9FD6F61620F040855446C051E536FE25A93406160B27AA24B208BA392DDFD4D73B03217D3D0C3CE3A9DC0FAD9F7AE937F073F7669E87D6B13C1B5A0D80E178E96CB40151EA82B9C198DFBE32F3E3DC70CFACA88E5646B7650A8C1BE93596AD874665DBDE7271BB674DA5169929667D088866AD118F8A707B469AFE6FD7BB0DD8CFC6FFEAB4A0663B43EA9EB64B0B3FA05E55E9B451084F9FE632D94B3B9DB91BDD7409B6A179467871768765230AC7FB86B1F8566793469C075AF8E2CE5F5C338EA4E1104D2CAD88AA532856F6D3981D2EE1AE2CE4178C0DE02A63AABDEECC75C9FB4BF936CC84CC0ECCF37077454524B77C6800C7D65AB43F96D3A3175B03E563A4CB328F0AE376DA198B800C9906BD14E4E258DD6F775FDD404E7084B70DE13086788B7EF1C9E7529A4AC944E90225DA1B31AF3FE62B3D133940062BC5683B5175947A38F3A8CAFA4726BD37658FC84CA4EE223A62E0D6C9A6536901900C21CE19B8BA753D4C146ADCE935285F85A38E4787F0AEAFA606259105353E4B5BB6AF46F9D8718DD3BCFC077175AB31EF6FEB768DA5597870F726E18DFA23B23934ED32382551B78A5167FEBD2B369C5F22BA5E55BA80B5F1BA680373D1F05D7CD81438774EB9BFFF338011042C39622159EE86F2F16F9F16DEB6DDC85488469663C5D69B87315E499EFB7A9891F1DDBF0FDAE3AA1A013561C12F420C7E1CD588F9CA0F7FF12E93890F24C60400D89D937642BBC268D0892482420E940386F2F5EA0C2D0641F5E65F81A53F656FB8674BEFF4FDA38EE2693CB5631674F6FDB30D058ADC684738A61647123CBDDE9DF4FB89C15332517CAAB1503DF0BD6D5D8D3A4514AEBDF618A7D7AAE8036C7EAEF0FF2E2AAFF59CB15779D8FC311F682E347A545988E9C45CEE1D2BB092858A8700925818AF2872683B651E86339E47A7443905FA7A32494CF4AD3C8020333903CF337CB2B306B872849F84FF64BED97220DE3EC7789BD3173B048166B40720AA8BAA2B7C1A1C37912282C498AAB84880A4065546939A2A4ADA7AFC80E81BA300E4FC4BB41064E6D7E80C2BB8480441A671B2C601CADD23C6493F6F96064B3CE0EF20761523E34728394287F29A9E7FB4C26E07260BC0C201D0F07F606659E78B34A0D998D6C20433FE20C5E4FD09C6724E3A405E2936B45A3398F1DD2C026D6FB8C4B7DE1A622B987674DA0404187E6D39F5FD44BDADA3057F2A0A51C06A808193EEC47FF52B5AAF3105CDA04E42EC5B5B221B2DEE15A9BD1C630284B81DC9462C04F94EAE214C6A48A2D87C305DE643636184012324B57733AEFB5427071DEDE7B04154A0F38F5F476CE36341056E53AD0FDE1C7FB5815E3C6F2E6EE99FE2136EA040AAEE0D70735E5632C9B688347768E7D26B37014C00FC9261510888EE39C90193C1F4A50388FB9ECDF2110E440AC09898D64A2B9541DFE7D3D73983C35999BF5003913F59DB683A67ECA89D04446B3E5743498035085D8F706B07AA7F51B73AE49D422FEF3461DCA2B60572E11B800BF28C3C60F6D4F2DA8BBFE10678766A0FE3DC4DA727170F134C742F2B342476CB5EBB1B0D3398F34D47D4F70F885A2F0443D67567C4E987D8CF91182F11C3E2E8B778FC9BA62F64BB0FB61F9D408B0268B6564FAD0DAA247A7F84D39602960C3B4A94DD7C95DB0238429C114BAF50EBBC925B02DFA5DA6929A447656281CB32B19F81D8CAE72520FD0FE1B40075331EC7C1216BFCF73D3B1F14E39A8406234321C214D48EEAA39B968F628499D7721CD691DB9EBD1EABECFD309908955C677E82D654D71F5D6DAA754CCC132E63F41228F8BD03701C11795F8C6AA3E5A0D6296489341B9F0BC349C346F52CE99A55935643B0EA3692128C44A9B48BA0788DDAC36971909D272313612040E04B73CF62ADE15EADE2E2A6259FCF2DEB1152327D3AF2EC7C7837C122D8207D285D7F554BA4614A5DDBEEDBC66686D587F6784C57A546A1A77036CA1037274C646A046740553E0E8FA3F8704AF37E13CD8633C72B99F2F90822FDA5F6651A87D84ED9062E5AF22DE8BD1C9A8E7AD432E5F840F46BECFB32926F3E5F2CFEADD998D77A92A7C8984829D8C695BFD7B