/    Sign up×
Community /Pin to ProfileBookmark

Interperting JavaScript code

I was wondering if anyone could help me interpert or understand what this javascript piece of code actually does:

[CODE]<p>
Retrieve the html and follow the instructions <br />
<form name=”sec”>
<input style=”border: none; color: red; font-weight: bold” type=”text” id=”texti” onChange=”show();” />
</form> <br />

<div id=”texta”></div>
<br />
Hint: you are just one byte away

</p>

<script language=”javascript” type=”text/javascript”>

show();

function show() {
var v = [0x14e, 0x167, 0x11f, 0x173, 0x167, 0x168, 0x172, 0x11f, 0x176, 0x160, 0x172, 0x11f, 0x160, 0x16b, 0x16b, 0x11f, 0x175, 0x164, 0x171, 0x178, 0x11f, 0x168, 0x16d, 0x173, 0x164, 0x171, 0x164, 0x172, 0x173, 0x168, 0x16d, 0x166, 0x12b, 0x11f, 0x173, 0x167, 0x164, 0x11f, 0x16f, 0x160, 0x172, 0x172, 0x176, 0x16e, 0x171, 0x163, 0x11f, 0x168, 0x172, 0x11f, 0x172, 0x16e, 0x16c, 0x164, 0x173, 0x167, 0x168, 0x16d, 0x166, 0x11f, 0x178, 0x16e, 0x174, 0x11f, 0x160, 0x171, 0x164, 0x11f, 0x16f, 0x171, 0x16e, 0x161, 0x160, 0x161, 0x16b, 0x178, 0x11f, 0x16b, 0x16e, 0x16e, 0x16a, 0x168, 0x16d, 0x166, 0x11f, 0x165, 0x16e, 0x171, 0x11f, 0x160, 0x16d, 0x163, 0x11f, 0x168, 0x173, 0x11f, 0x168, 0x172, 0x11f, 0x167, 0x164, 0x171, 0x164, 0x11f, 0x161, 0x164, 0x173, 0x176, 0x164, 0x164, 0x16d, 0x11f, 0x173, 0x167, 0x164, 0x172, 0x164, 0x11f, 0x15a, 0x13b, 0x120, 0x12c, 0x12c, 0x11f, 0x173, 0x167, 0x164, 0x11f, 0x16f, 0x160, 0x172, 0x172, 0x176, 0x16e, 0x171, 0x163, 0x11f, 0x168, 0x172, 0x11f, 0x168, 0x172, 0x164, 0x164, 0x132, 0x165, 0x160, 0x173, 0x16f, 0x164, 0x16e, 0x16f, 0x16b, 0x164, 0x16e, 0x16d, 0x160, 0x161, 0x164, 0x16d, 0x162, 0x167, 0x11f, 0x12c, 0x12c, 0x13d, 0x15c, 0x11f, 0x161, 0x171, 0x160, 0x162, 0x16a, 0x164, 0x173, 0x172, 0x12b, 0x11f, 0x168, 0x16d, 0x11f, 0x160, 0x11f, 0x167, 0x173, 0x16c, 0x16b, 0x11f, 0x162, 0x16e, 0x16c, 0x16c, 0x164, 0x16d, 0x173, 0x11f, 0x173, 0x160, 0x166, 0x12d];

var t = “”;
var n = parseInt(document.sec.texti.value);

if(!isNaN(n)) {

for(var i = 0; i < v.length; i++) {

t += String.fromCharCode(v[i]-n);

}
}
document.getElementById(“texta”).innerHTML = t;
[/CODE]

I would be really thankfull, thanks ?

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@Kostas_ZotosJul 27.2008 — Hi,

I am a bit sceptic for the reason of this..

The code is a simple cryptographic method based on the ASCII codes. Eg. the capital A corresponds to 65, etc.. (a "secret number also added to this value and converted to hexadecimal, to increase a bit the difficulty of the decode process)



-Well, the code creates an input text field where, expects you to insert a number in order to reveal an encrypted message..

-The array contains hexadecimal values of characters ASCII code (minus the "secret" key number)..

-The "String.fromCharCode(v[i]-n)" used to retrieve the original characters in the for loop ( if you provide the right key-number will get an english readable message.. as alredy reported)



In other words its a decode process [the reverse process of example something like: ("Initial Message".charCodeAt(i)+SecretKeyNum).toString(16)]..





Just to not keep you in curiosity, the original message was:

"&#65327;&#65352; &#65364;&#65352;&#65353;&#65363; &#65367;&#65345;&#65363; &#65345;&#65356;&#65356; &#65366;&#65349;&#65362;&#65369; &#65353;&#65358;&#65364;&#65349;&#65362;&#65349;&#65363;&#65364;&#65353;&#65358;&#65351;&#65292; &#65364;&#65352;&#65349; &#65360;&#65345;&#65363;&#65363;&#65367;&#65359;&#65362;&#65348; &#65353;&#65363; &#65363;&#65359;&#65357;&#65349;&#65364;&#65352;&#65353;&#65358;&#65351; &#65369;&#65359;&#65365; &#65345;&#65362;&#65349; &#65360;&#65362;&#65359;&#65346;&#65345;&#65346;&#65356;&#65369; &#65356;&#65359;&#65359;&#65355;&#65353;&#65358;&#65351; &#65350;&#65359;&#65362; &#65345;&#65358;&#65348; &#65353;&#65364; &#65353;&#65363; &#65352;&#65349;&#65362;&#65349; &#65346;&#65349;&#65364;&#65367;&#65349;&#65349;&#65358; &#65364;&#65352;&#65349;&#65363;&#65349; &#65339;&#65308;&#65281;&#65293;&#65293; &#65364;&#65352;&#65349; &#65360;&#65345;&#65363;&#65363;&#65367;&#65359;&#65362;&#65348; &#65353;&#65363; *************&#65293;&#65293;&#65310;&#65341;&#65346;&#65362;&#65345;&#65347;&#65355;&#65349;&#65364;&#65363;&#65292;&#65353;&#65358; &#65345; &#65352;&#65364;&#65357;&#65356; &#65347;&#65359;&#65357;&#65357;&#65349;&#65358;&#65364; &#65364;&#65345;&#65351;."[/QUOTE]



(I miss the actual pasword (and to report the key number) just in case this is something serious or not legal or maybe the creator just don't want to expose it in public)..







It seems like a "game" to me.. its not a secure cryptographic method and is easy to anyone (who have a basic knowledge) to decrypt -decode it.



Was no sure if must sent this post, because we don't know the reason or task (if any) for it..

Anyway, hope this to be for a good reason.. or at least not for bad..



Bye!
×

Success!

Help @Giga spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...