EG Information
Training Missions
Knowledge Bank
Pimp Us Out!
Has Enigma Group Helped You? Then Help Us By Advertising For Us. Place One Of The Following Images On Your Site And Create A Link Back To Enigma Group.
|
| |
Affiliates
|
|
Enigma Group's Code Bank
Binary-Ascii-HEX-Plain text converterBy: Link- - Date Submitted: 2008-09-26 10:22:23 <?php /** * Code created by Link- * * Email your questions-comments to: Link.random@gmail.com * * * * Simple and easy... Although HEX conversion is not created yet * It will be included in the next version. * * Version 1.01 **/ ?> <html> <head> <meta http-equiv="Content-Language" content="en-us"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Binary-ASCII-Hex-Octal Converter</title> </head> <body> <table border="1" width="53%" id="table1"> <tr> <td colspan="3"><font face="Verdana" size="2">● Enter the code you want to convert and click calculate:</font></td> </tr> <tr> <td width="202"><font face="Verdana" size="1">Output delimiter:</font></td> <td width="357"><form action="bahoc.php?action=convert" method="post"> <font size="1" face="Verdana"> <input type="text" name="delimiter_box" size="34" style="border: 1px solid #000000; font-family:Verdana; font-size:8pt"></font></td> <td><font face="Verdana" size="1">[ex: , | ' ]</font></td> </tr> <tr> <td width="202"> <select size="1" name="code_type" style="font-family: Verdana; font-size: 8pt; border: 1px solid #000000"> <option value="CT1">Binary</option> <option value="CT2">ASCII</option> <option value="CT3">Plain Text</option> <option value="CT4">Hex</option> </select></td> <td width="357"> <textarea rows="6" name="original_code" cols="42" style="border: 1px solid #000000"></textarea></td> <td> <input type="submit" value="Calculate" name="B1" style="color: #FFFFFF; font-family: Verdana; font-size: 8pt; border: 1px solid #000000; background-color: #282828"></td></form> </tr> <tr> <td colspan="3"><hr size="1"></td> </tr> <tr> <td width="202"><font face="Verdana" size="2">Converted code:</font></td> <td colspan="2"> <?php //Binary conversions hex-octal-ascii-text //Binary Validation rule function validate_binary($input) { $input = str_split($input); for ($i=0;$i<count($input);$i++) { if ($input[$i] != "1" && $input[$i] != "0" && $input[$i] != chr(32)) { return False; break; } else { continue; } } return True; } //END //Convert binary to hex-ascii-text function binary_to_all($input, $delimiter) { if (validate_binary($input)) { //Remove spaces and other unwanted chars $input = trim($input); //explode the string into array, delimiter is a space $orig_exp = explode(" ",$input); //recombine the string without spaces for ($i=0; $i<count($orig_exp); $i++) { $input2 .= $orig_exp[$i]; } //Split the binary code to a set of 8 bits to convert $orig_exp2 = str_split($input2, 8); for ($i=0; $i<count($orig_exp2); $i++) { $hex_string .= $delimiter . base_convert($orig_exp2[$i],2,16); $ascii_string .= $delimiter . base_convert($orig_exp2[$i],2,10); if ($orig_exp2[$i] == "00000000") { $text_string .= $delimiter . chr(32); } else { $text_string .= $delimiter . chr(base_convert($orig_exp2[$i],2,10)); } } echo "HEX :: " . $hex_string . "<br>"; echo "ASCII :: " . $ascii_string . "<br>"; echo "Plain-Text :: " . $text_string . "<br>"; } else { echo "This is an invalid binary number!"; } } //END //Valid ASCII code doesn't contain letters, chars, etc.. function validate_ascii($input) { $input = str_split($input); for ($i=0; $i<count ($input); $i++) { } } } //END //Convert ASCII to hex-binary-text function ascii_to_all($input, $delimiter) { if (validate_ascii ($input)) { //Remove spaces and other unwanted chars //Explode into arrays //Do the conversion for ($i=0; $i<count ($orig_exp); $i++) { $hex_string .= $delimiter . base_convert($orig_exp[$i],10,16); //Make sure that the binary is made of 8 chars not 7! $binary_string .= $delimiter . base_convert($orig_exp[$i],10,2); } $text_string .= $delimiter . chr($orig_exp[$i]); } echo "HEX :: " . $hex_string . "<br>"; echo "Binary :: " . $binary_string . "<br>"; echo "Plain-Text :: " . $text_string . "<br>"; } else { echo "This string contains invalid characters!"; } } //END //Convert Plain-Text to ascii-binary-hex function text_to_all($input, $delimiter) { //Explode into arrays $orig_exp = str_split($input); //Do the conversion for ($i=0; $i<count ($orig_exp); $i++) { $ascii_string .= $delimiter . ord($orig_exp[$i]); //Again make sure every binary code is 8 chars if ($orig_exp[$i] == " ") { $binary_string .= $delimiter . "00000000"; } } } echo "HEX :: " . $hex_string . "<br>"; echo "Binary :: " . $binary_string . "<br>"; echo "ASCII :: " . $ascii_string . "<br>"; } //END //Convert HEX to ASCII-Binary-Plain text //First we validate the hex code function validate_hex($input) { $input = str_split($input); for ($i=0; $i<count ($input); $i++) { if (!is_int($input[$i]) && $input[$i] != "A" && $input[$i] != "B" && $input[$i] != "C" && $input[$i] != "D" && $input[$i] != "E" && $input[$i] != "F") { } } } //END //Now we do the conversion function hex_to_all($input, $delimiter) { } //END //Switch to functions according to main code type. if ($_GET["action"] == "convert") { $conversion_type = $_POST["code_type"]; $conversion_code = $_POST["original_code"]; $delimiter = $_POST["delimiter_box"]; binary_to_all($conversion_code, $delimiter); ascii_to_all($conversion_code, $delimiter); text_to_all($conversion_code, $delimiter); hex_to_all($conversion_code, $delimiter); } } //END ?></td> </tr> </table> </body> </html>
|
| Return to
php category list |
|
|
Who Visited EnigmaGroup Today?
1512 Guests, 298 Users (193 Spiders)
ant0601, BlAd373, nmobin27, myfabregas, spartanvedicrishi, DrOptix, g3nu1n3, saraf, VireekadiaFap, obencefoozy, memoryshot, mongrel88, drag0n, Kearstin29, litbk, alexelixir, r0z4, Abhinav2107, theanonymous21, greatg, CreedoFiegree, bivaEmilltite, posthuman01, Taireegaddita, Taicadine, c_a13, hizImmoli, scifics, slchill, KELATALFTUS, kynapse, Tonyui, Hackpad, Epilioptiop, Mamorite, IodindDog, brunoriversyhn, Effomeidonize, ReottphoffBom, arktek, burgeoningneophyte, TradaGreant, SlayingDragons, Waldlyeps, Arsenal, CJ_Omaha, Ryuske, thethird3y3, todayadvila, pwnpwnlolz, NeetaexomYgom, ookami-namikaze, dot_Cipher, Unotohumsmush, SaubymorRoyab, loltyg, Ausome1, Rik, hrangel, cyber-guard, Meonkzt, mori, 31415926, optioniLele, intorerse, FlifobbyFloks, Ios, Røgue, cossyDrybrich, IvanDimitriev, havisham, KIKNWING, fitz, fleeloCycle, hackboy302, strudels, CootoDorbeeft, gymnediny, hustleman9tv, comando300, Ysri13, thatoneguy, Paran0id, whoami, Pitanteerve, Reapon, cls777, Afrika, suetekh, somebody777, floontiny, Frudopvia, jasonbourne, zombiehack640, CloverCipher, spoosh, Fraubbova, rulebreaker, dncjor, Fintyoptots, viRuleNt, NipPaineHainy, TheHarrisonW, Jamesgo, TheGanjator, psychomarine, 1421carter, tingle65, claudius, Feld Grau, Partisan, Gunslinger, gydeqqzpn, yshiau, Zaccarato, chromoSone, priovasashCor, ellisp, GothicLogic, keetone, M0rdak, UsedDeteKef, nhorton, archestraty, HatriteBeft, JC06dc5, alpha1, spg, dark_void, wakazi, mtroscheck, TheCheeseDemon, ach.n30, sahariar, hervelegeraf, Psiber_Syn, hackaday, Mod777, neompenly, pollolololo, SnoopSky, Cigmimifs, ProloG-Shaman, unicornrainbow, cheapnikeshoxog, bobsters, foofthoorgo, polemarchos, avacraft, spencerwilliams23, lotato, ryanjcrook, dollerolf, robintenboden, rospark, WexEmbet, BeefSupreme, Hessesian, whydoyoulook, cdpirate, DnA-Ender, CaNcEr, zheincnoob, Vengeance987, justforfun363, RawTeefecycle, Squissesk, aVoid, SaMTHG, neodude, Marion1p, Ops, ddxc, Klosse, khamhou, samsatHD80, PauffPubadvic, AnnaNoult, SexyCreerve, newb1, robster1977, Blizer, Dudleypagrove, Mr_KaLiMaN, FirewallPenetrator, GMo, Seasharp, mrchicken1, Zaxem, N4g4c3N, MaxMeier, Ian, sander.ashwin, Predatorc, lonely.connection, ElEnfermado, wavyd, dirkdanblue, cve916, kalak55, a1los, jell0, Exclaw, veceattainc, Muselele, Mr Pacifist, stylish007, zach, closednetwork99, soroimmuror, PlaneReaction, Wamemanytex38, DieAble, d0seN_36b, jeremy.whitson, lol, nefeolnb, Noticon, statix, anandoump, RomeoG, advilapyday, snorapa, Gkjt, autotuneuser, beanulpinee, 2142, kiklopas, door51, Pizza, deepakkumar, makler2004, M4rcy, Xargos, bdkoenig, Blavatsky, m4f10, Huasca, itsme, xu_lain, Nikhil, ChewBigRed, samxoxo, incicaMaidits, toudioria, Chidokage, Jigoku, cesecyclelm, schn1ffl3r, sam20000, learning, kentora, San Marino, Nightraven, zanydouner, FrofErrodslot, FatalEror, wheaties, akki, AlexDiru, unclejos666, override101, blink_212, uncowstientee, lilkpoigogs, Innonaenupt607, Killshot, ZheIncKnight, ActictGlync, acarseflalk, ___, trashsporn, Memartent, Zoorsornaks, z3z3, heyhey123, Ghajnm, usaliaPels, Ordeptpen, pelly, quellense, Szuba, lamb, x1rt4m, ToutousaRulty, vipervince2002, mannavard1611, BinaryShinigami, Duchdund, afgnumgt, Anatissa, darkfire1515, bennyblanco5000, Mmmett50, ToryLogsEsoff, impalwinona, Kelsfednege, ensubbrut |
| |
|
|
|
|
|