473,545 Members | 2,091 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need help understanding this part of code. Explanation in post(2008-04-18)

Hello.
I am not new to javascript but i saw a function or a part of code i am
not familiar with.
I am currently building a PHP wrapper to be able to encode fAES string
from php and decode them with javascript.

My main problem at this time is this little part of code.

var nonce = (new Date()).getTime ();
for (var i=0; i<4; i++) {
counterBlock[i] = (nonce >>i*8) & 0xff;
}

I have absolutely no idea what the >>means as i have been unable to
find anything on this.
This code is JavaScript.

I know i am new to this group but, if i am at the wrong place to ask
for help, just move or delete my post.

P.S. i know i am asking a lot but, if someone has an idea how i can
reproduce this under PHP, i would greatly appreciate.

Thanks
Jun 27 '08 #1
1 941
<pa*****@patric k-isp.comwrote:
<snip>
My main problem at this time is this little part of code.

var nonce = (new Date()).getTime ();
for (var i=0; i<4; i++) {
counterBlock[i] = (nonce >>i*8) & 0xff;
}

I have absolutely no idea what the >>means as i have been
unable to find anything on this.
The - >>- is the bitwise unsigned right shift operator (ECMA 262, 3rd
Ed. Section 11.7.3). The left hand side operand is converted into an
unsigned 32 bit integer and shifted right by the number of bits
specified by the right hand side operand (the result of the expression -
i*8 - in this case). The result is then converted back to a normal
javascript number (an IEEE double precision floating point number) and
that number is the evaluated result of the unsigned right shift
expression.

Incidentally, the - & - is the bidwise AND operator, so the effect is to
mask out all but the lower (right-most) byte of the shifted number.
This code is JavaScript.
It is.
I know i am new to this group but, if i am at the wrong place
to ask for help, just move or delete my post.
It seems like a reasonable question to ask here.
P.S. i know i am asking a lot but, if someone has an
idea how i can reproduce this under PHP, i would
greatly appreciate.
I have no idea at all. The PHP documentation is where I would start
looking (either PHP has an equivalent operator or it does not, but if
not the same effect could be achieved with other math operators), but
not right now.

Richard.
Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2142
by: worzel | last post by:
need some simple code to copy text to clipboard in c# - my app has right click > copy to clicpboard feature, which is best way to do this?
6
3571
by: Randy Harris | last post by:
I wonder if I might get some of you to describe methods or tools that you've found effective to store and manage code snippets and routines. I don't have a particular need to share code with other developers, but I'm finding that my personal code in a bunch of little files is becoming unmanageable. Any suggestions are appreciated.
2
1239
by: mb | last post by:
got the following code snippet that i've modified off the internet to work - but damn if i know how and i dont like that. im having trouble with the following thread declaration that creates the thread, calls the ScanPorts method in the ScanPorts class and somehow passes in the array list scannedSystems. i'm stumped - how does it do all that...
14
5495
by: mistral | last post by:
Need compile python code, source is in html and starts with parameters: #!/bin/sh - "exec" "python" "-O" "$0" "$@" I have installed ActivePython for windows.
2
4478
by: deltaa5 | last post by:
Hi. i need a source code compute logical expressions in lex/yacc. for Example: (20>5) or (6<=6)--->true (1<=2) and (3==1) --->false.
1
7492
by: leox | last post by:
Need C++ source code for Coppersmith-Winograd algorithm of mathrics multiplication. Is there any c++ internet library?
1
1700
by: kavir | last post by:
hello I need a source code program(socket programing with java) that: 1- for a car parking 2-send&save car details to server DB 3-Enter & exit & perice 4-report 5-login
3
2976
by: =?gb2312?B?zfW2rA==?= | last post by:
I need a C++ code style checker. Which is the best choice? free or for fee.
3
2764
by: tartz | last post by:
plzzzz...help me i need a source code for pancake sorting in c++.. plz... help..
0
7401
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7808
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7423
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5329
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4945
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3450
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1884
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1014
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
704
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.