Jump to content

Recommended Posts

So I have coded php for about 5-6 yrs and have never really needed to use binary conversions and the bitwise operator like >> or << .  I took a php class in college but that basically consisted of the students trying to learn php on their own...  So i have never had any exposure to that portion of php coding.  I have to take an exam on PHP with a bunch of questions that DO NOT show how good of a coder you are.  There are a bunch of questions on bitwise operators and binary conversions... Am I missing something???  Whats the point of converting a string to binary or knowing how to do this in your head?

 

Any help?

Link to comment
https://forums.phpfreaks.com/topic/213165-php-binary-and-bitwise/
Share on other sites

I have found resources in regards to this question...

 

for anyone troubled with the same issue...

 

1) First research binary code and learn how binary code is constructed... specefically to numerical values.

 

2) The php bitwise operators are used to manipulate binary code in regards to certain tasks.  To understand why search application for bitwise operators.

 

For the most part, i don't see why it is important to know this.  It may come in usefull someday... :/

For the most part, i don't see why it is important to know this.

 

In PHP this may hold truth as almost everything is available through the extension library. However it is important to know this stuff if you look at implementations of encryption/decryption algorithms in order to understand them or if due to business needs you need to create an exotic implementation of your own. In the latter case you'll need a good understanding of encryption/decryption and bitwise operators.

Hi all,

 

I'm not too sure on this, I know that php is (or was) written in C and C utilises bitwise operators everywhere, so I am pleased that php offers this sort of thing, though for me I have never used it and doubt I ever will within the context of PHP, but my background means as I have to know it, and learning Binary is easy once you get to know how to read it!

encryption/decryption algorithms in order to understand them or if due to business needs you need to create an exotic implementation of your own

Wow, that sounds like a challenge! I hadn't even ventured a thought down that path in PHP; I just keep to the hash() function personally, but the rate that things get hacked these days, it could be prudent to have a bash at it in the future, just thinking about it makes my head hurt ;-p

 

Also, I guess that if you went on the Zend certified engineer course for php this would be part of the course if not an entire module.

 

Cheers,

Rw

 

but the rate that things get hacked these days

 

If you take the necessary precautions and spend enough time tweaking/testing there is nothing to worry about. Don't forget that the PHP market - due to it's small learning curve - is polluted by "programmers".

 

just thinking about it makes my head hurt

 

1) Don't fix what ain't broke, your hash() function will still do. 2) There are books that explain encryption (if you ever feel the need)

@ignance:

There are books that explain encryption (if you ever feel the need)

Could you recommend one for me, I am quite intrigued about this; if it's worth spending a couple of days over it might pay dividends in the future..

your hash() function will still do

That's good to know, I have just been through majority of my projects and changed md5() -> hash('sha512', $data) because I read that md5 had been hacked.  Whether I was correct to do this remains unseen.

If you take the necessary precautions and spend enough time tweaking/testing there is nothing to worry about. Don't forget that the PHP market - due to it's small learning curve - is polluted by "programmers".

Yes indeed, I spend quite a lot of time testing things before I release stuff onto our intranet, even though it's isolated you still get the linux kid's trying to prove a point, keeps me busy anyway!

 

Cheers,

Rw

Could you recommend one for me, I am quite intrigued about this

 

No, I had it in college but I ain't keen referring to my teacher's books out of principle :D

 

because I read that md5 had been hacked

 

If you salt whatever your MD5 encrypting then there is no problem.

 

even though it's isolated you still get the linux kid's trying to prove a point

 

Testers are your friends ;)

Yea.  I'll probably never use it.

 

As for encryption.  It depends on the case.  It you are converting an old database, then ignace is correct with using the MD5 encryption method with salt.  The reason is that you can create a script to automatically update the passwords that already exist.  The possibility of the salted password existing in a rainbow table is small.

 

For new databases, no passwords stored already, try using SHA-256.  It is considered one of the most secured methods of encryption.  You can find plenty of material on implementing it within php...

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.