用int类型实现类型unsinged int的右移操作
有很多脚本语言里面没有 都是 没有 unsinged int 的,如 PHP。位运算 一般来说 int 和 unsinged int 没有什么差别,除了右移操作,在int 中是补1 在 unsinged int 中是补0,我想了好久,终于想到了一个比较妙的方法,只是,这个方法,右移的次数至少大于1。一般来说,0右移 没有什么意义。
(($a >> 1) & 0x7fffffff) >> ($n -1) 这里$n 是右移的次数。 $n >= 1
比如,实现md5加密,一般来说要用到下面的函数,在PHP中可以这样实现:
{
return ($a > 1) & 0x7fffffff) >> (31 - $n)); 注意运算符的优先级
}
对加密解密比较感兴趣的人,应该遇到过和我一样的问题,不知道有没有谁有更好的方法。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 Linux new version
SublimeText3 Linux latest version

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 English version
Recommended: Win version, supports code prompts!

Dreamweaver Mac version
Visual web development tools
