Jump to content
code34

OO CIPHER - Cipher / Uncipher your string

Recommended Posts

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

 

  • Like 1

Share this post


Link to post
Share on other sites

"Ãó+ýCZ Û&Â’pë±Û ïý™Ùoë§RÔÞ¾cCµÂ†

 

key = "magpie"

Share this post


Link to post
Share on other sites

i dont think you can use paste / bin directly the sequence into forum to use it :( There is some extra char that certainly should be escape.

 

To do those kind of things, the cipher string should be export to hexa format. It certainly should work

Share this post


Link to post
Share on other sites
cipher data with RC4: F3069DBB0935799CDDBEFF70168F5F3FDB7C7B6EEEF001E2C64120B1A2C80A2B134DBCB5BB3A12C66865A5E1AA2816A13113E8B3024339E52F485FAA98C8E0C6F394884BEC895331B93244E7A1EB94195EADE7EC56E214DE648E3A353B8C4CA6F33710E5BAFE508C083C06FD5BD4D19EECB0F3AB6028FD4D96BEF51A8ED8AC6511CA8960D999B6BA8B5C55ABD1D80D89C8398E86CDF06A1D7ECF0E610235E30741AA9092CBC6942F67ABF4E40325D294FD01AA90DE3CE160D44BEE0799A7A8E182FDA1B42221DA0F3CDFE5D2316FAC9B8C1F1571CA5E6D33AFAD191F88CB0D1BB84CF8E4D5721B3813B2D471B59AF929C939F244633F2716A921060B90EEADFD2075652A3D6283AEC2D6D0A00191566601EB6E84E4508F8D252E2A2498ABF16B8EE4590F96571B6F0C0F7300C1BB0FB0EF99F575C259AD33395BE073BDF7E01E38E59F8D7D3E51682CA4393BC249D45F3021AE201B5D4B9A5F929995893CFE48844BB212D02CBA84E8E65DA3B64C944A2955B108FB8F607630C4B5B8110B7DDCE7A20BBE94E739FD42A5D42AC4B1C60165B82A58E3468C0E33046E0DC7E41746E43CBF16A01DD094355D47056D615585C68D946871F81CFF1B15933CE3CF5A9AAE739A6DFFDD169D0C3028845AD7AC5E5F290D55653DEC6E865935507FA26EF37895BD6F91AD79387D61494C9914C7B69AF6EB0E6708691FA82685B9BE4DBADC251BE8945149352D9F626FC09E244D19222E6969F5E7A60041E832979B4AD14160E7AC1528B47E8C802AE0FC52B2A7003FE960589F6EAA08B62665E9A6737BA55DFCA56936D18F83B686824BF96A80CDE53B4214B5FB3E01FAD013D424B8F36384CB96144F655F936C84AB16019F0B5F8245E2E1810076E5E7A4419B7C6606F570AFACC70B94FF20BF0242C066EBF2C1902E8D75F2D5365AD1A42F1650F50E74B359C258BD2C18CF0EA10FBB58DF8DB895A280F35008A7E74878FD01069E11C2CAC0A8E34EE99BFE8640A42C288F91A5525D13AA6DE6DDDE634B76CD0D60934CA87B3314BE4C29F390002777F0A5A3F13049D381F5EBC9E93B373FF8BB640363D0C01DC5A8C779EFD87EFE82DCA0BEB096770BC327DD63E17C6CF63A1182597AE0F6F2936A84F004C3BC6244BEFCBCBF9CED26CE0D0B0FF9894C8003926A17AE9058C065F84712AEDFE1C01CE643D6A726881259435CDAB3052BDBB8204118E2583A5606F46285710E3C15C23A2D7DAAC849B0B14C3B2F0EBC771ECBE472AD34059C9B80112301A5C7DF668AE263134844D7F4D30A1E02F75B8ACABDB568E3AD46F53769BB5409824CD6BEC3A3731EADB2ECC799A42EAD0ED0A3EC2358E3018B60F7FBB09F7E20CB3533C4118AE23CA963364082B8A3B1AD3A5B2D1C1147ECA62BBAEFF9D3DC842514CB56FCB5BFEA1E76D1818E606DFB093CA8A2F79D5A78B4FE2CA510FD772FD3BA37913B02173D702D95B6C52D2100F15A735D58C2412FD6F4CE5432A5F9C32CC3B9E77EC72DCAC4F2FD341F9D0ED9FDC745382C354C7A767DC924ECB3794055FEC5B1DEF257AF089721B404B512B649101ABD4ACFF2FA2E95E240EECF0AC35FEE3BD9DA0628C7847CD4A8D7FC8437E9224B1CC98960F9BFC2E8BC745885A8AA19C4B239533900004D6321AB4390DE3EB7961B0ACDB868DC21B55DF1B3ACE9D3FCC8A9054FFF57D4BDED4B93AA621F0DDCCA8165A0D62A2DF5E548227399D33F1CB3AA0ACC66262935981755176148A71B0E362F065D06A8A2F355872428BC4930756C4A61DE570E58408F16DCE7AC37D3CF35D015E53A0F157DEECB9D1B2C80956CA5DFA6F1EEABEA799B899C7F50AF2B8F40D25105A474CB1DE7A7BFD7A10284ABA3FAE913ACC16467038E92F679E72BE770EE88D94A0A1BFDFFD150B28EC2ED0B3989E10C17190B422B43203EAC1695E841EACEAB9A875F6679D566BDB1E768270A5FEB1FFB5F2A11ED8B7258968598152EF4791EB22B4256173C159F530AE4590C30BC6CBDE009CAB6D58A5EC88B8DFEDD812D75699C1FC4235A2BECA8CDF7AAF1DD14200362DF37611307B473657F554CD4FA65FE28A27F480B6A68DA8B7EF09C30857F6503F14F5A9A71D7319B19BF53F3EE54A46E2923

das attorney what do you think about that, ready for another test :p

 

just add v 0.2 to github :don8:

 

i have a very strange behavior :( hexa convertion works, un/cipher seems to work too, but i dont have compatibility with RC4 online tools oO

  • Like 1

Share this post


Link to post
Share on other sites

That gives so many possibilities, I'm like a child in front of a Christmas tree :D

  • Like 1

Share this post


Link to post
Share on other sites

i investigated about the compatibilities. It dont really understand where it comes from, but it seems that certains website doesnt use the same algorithme to generate the first key.

 

I use the original algorithm and add my own part (no more compat with external system), it s perhaps better but dont know until which point.

 

Anyway, i just release the version 0.4 (perhaps the last ?)

 

changelogs:

- i refactory factory name, now use cipher / uncipher methods to do the jobs :)

- export of ciphered data are in hexa format

- 2048bits key

 

:don15::don15::don15::don15::don15::don15:

 

 

password : greatsecret
A00A5F7A31B2AA9F6CF4C7E68A4DF536BDE5625FF1537900AA041CC628088234A83B6233B3C5E74661447CFF2F79867C3552F7CAAD40C6D0599A80A013BBE5CD9EACBFFA4FD7C1C255971F

 

Share this post


Link to post
Share on other sites

hi

 

Just release a hotfix  v0.5

 

- fix a major issue concerning stream generation

- fix the mod value

- tune hexa for command line tools

 

https://github.com/code34/oo_cipher.altis

 

all script / modules that used version 0.4 should be upgrade as soon as possible.

Share this post


Link to post
Share on other sites

hi Dudes :)

 

Just release a command line tool "LUCIPHER" compatible with OO_CIPHER

 

more informations at this place

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×