There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
access audio avg avg 8 bios blue screen boot bsod computer connection cpu crash css dell desktop dma driver drivers dvd email error excel explorer firefox firefox 3 freeze gimp graphics hard drive hardware hijackthis hjt install internet internet explorer itunes keyboard laptop macro malware monitor motherboard network networking outlook outlook 2003 outlook 2007 outlook express pio problem problems router seo server slow sound sp3 spyware trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless
Web Design & Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
javascript comprehension


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
redivivus's Avatar
Senior Member with 1,457 posts.
 
Join Date: Mar 2006
Experience: 8th hindu reincarnation -- Praise Allah
02-Nov-2006, 01:40 AM #1
javascript comprehension
str+=_8.charAt((_6[i>>2] >> ((3 - i%4)*8+4)) & 0xF) + _8.charAt((_6[i>>2] >> ((3 - i%4)*8 )) & 0xF);

Can someone help me comprehend this? Not sure what >> means or & 0xF in javascript.

So far i know that _8 is a string, though im not quite sure what position we are taking the charAt from.
__________________
Knowing others is wisdom;
Knowing the self is enlightenment.
Mastering others requires force;
Mastering the self needs strength.
~ Lao Tzu

If the rest of them can survive only by destroying us, then why should we wish them to survive?
~ Ayn Rand
brendandonhu's Avatar
Distinguished Member with 15,988 posts.
 
Join Date: Jul 2002
Location: Ann Arbor, MI
Experience: Advanced
02-Nov-2006, 06:58 AM #2
>> is the bitwise right shift operator. & is a binary "and".
redivivus's Avatar
Senior Member with 1,457 posts.
 
Join Date: Mar 2006
Experience: 8th hindu reincarnation -- Praise Allah
02-Nov-2006, 01:07 PM #3
Confusing me.

Quote:
The value of a right-shift expression e1 >> e2 is e1 / 2e2, and the value of a left-shift expression e1 << e2 is e1 * 2e2.
So why do we need this opperator if we can just use that instead?

Quote:
The left shift operator causes the bit pattern in the first operand to be shifted left the number of bits specified by the second operand. Bits vacated by the shift operation are zero-filled. This is a logical shift, as opposed to a shift-and-rotate operation.

The right shift operator causes the bit pattern in the first operand to be shifted right the number of bits specified by the second operand. Bits vacated by the shift operation are zero-filled for unsigned quantities. For signed quantities, the sign bit is propagated into the vacated bit positions. The shift is a logical shift if the left operand is an unsigned quantity; otherwise, it is an arithmetic shift.
So i originally thought it was shift and rotate, which seems like it would be better for a hash function to me. Anyways this is interesting.

http://en.wikipedia.org/wiki/Bitwise_operation

Just read this and its very interesting also. Leaves me wondering what >>> is though. Gives this example x=(byte)((y&0xFF) >>> 2) which pretty much makes me want to shoot myself through the foot.
__________________
Knowing others is wisdom;
Knowing the self is enlightenment.
Mastering others requires force;
Mastering the self needs strength.
~ Lao Tzu

If the rest of them can survive only by destroying us, then why should we wish them to survive?
~ Ayn Rand

Last edited by redivivus : 02-Nov-2006 01:14 PM.
brendandonhu's Avatar
Distinguished Member with 15,988 posts.
 
Join Date: Jul 2002
Location: Ann Arbor, MI
Experience: Advanced
02-Nov-2006, 03:04 PM #4
Quote:
Originally Posted by redivivus
So why do we need this opperator if we can just use that instead?
Bitwise operators are used for lower-level programming (doing operations at the bit-level.)

Quote:
Just read this and its very interesting also. Leaves me wondering what >>> is though. Gives this example x=(byte)((y&0xFF) >>> 2) which pretty much makes me want to shoot myself through the foot.
With >>>, empty positions are filled in with 0s.
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 09:48 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.