国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

? ??? ?? PHP ???? php兌現(xiàn)java的byte數(shù)組轉(zhuǎn)換

php兌現(xiàn)java的byte數(shù)組轉(zhuǎn)換

Jun 13, 2016 am 10:54 AM
byte bytes param position val

php實現(xiàn)java的byte數(shù)組轉(zhuǎn)換

由于工作需要,自己寫的一個php實現(xiàn)java的byte數(shù)組轉(zhuǎn)換的類。



/**
?* byte數(shù)組與字符串轉(zhuǎn)化類
?* @author zikie
?* Created on 2011-7-15
?*/

class Bytes {
???
??? /**
???? * 轉(zhuǎn)換一個String字符串為byte數(shù)組
???? * @param $str 需要轉(zhuǎn)換的字符串
???? * @param $bytes 目標byte數(shù)組
???? * @author Zikie
???? */
????
??? public static function getBytes($str) {

??? ??? $len = strlen($str);
??? ??? $bytes = array();
?? ??? ??? for($i=0;$i?? ??? ??? ??? if(ord($str[$i]) >= 128){
?? ??? ??? ??? ??? $byte = ord($str[$i]) - 256;
?? ??? ??? ??? }else{
?? ??? ??? ??? ??? $byte = ord($str[$i]);
?? ??? ??? ??? }
??????? ??? $bytes[] =? $byte ;
??? ??? }
??? ??? return $bytes;
??? }
???
??? /**
???? * 將字節(jié)數(shù)組轉(zhuǎn)化為String類型的數(shù)據(jù)
???? * @param $bytes 字節(jié)數(shù)組
???? * @param $str 目標字符串
???? * @return 一個String類型的數(shù)據(jù)
???? */
????
??? public static function toStr($bytes) {
??? ??? $str = '';
??? ??? foreach($bytes as $ch) {
??????? ??? $str .= chr($ch);
??? ??? }

?? ??? ??? return $str;
??? }
???
??? /**
???? * 轉(zhuǎn)換一個int為byte數(shù)組
???? * @param $byt 目標byte數(shù)組
???? * @param $val 需要轉(zhuǎn)換的字符串
???? * @author Zikie
???? */
???
??? public static function integerToBytes($val) {
??? ??? $byt = array();
??? ??? $byt[0] = ($val & 0xff);
??? ??? $byt[1] = ($val >> 8 & 0xff);
??? ??? $byt[2] = ($val >> 16 & 0xff);
??????? $byt[3] = ($val >> 24 & 0xff);
??????? return $byt;
??? }
???
??? /**
???? * 從字節(jié)數(shù)組中指定的位置讀取一個Integer類型的數(shù)據(jù)
???? * @param $bytes 字節(jié)數(shù)組
???? * @param $position 指定的開始位置
???? * @return 一個Integer類型的數(shù)據(jù)
???? */
????
??? public static function bytesToInteger($bytes, $position) {
??????? $val = 0;
??????? $val = $bytes[$position + 3] & 0xff;
??????? $val ??????? $val |= $bytes[$position + 2] & 0xff;
??????? $val ??????? $val |= $bytes[$position + 1] & 0xff;
??????? $val ??????? $val |= $bytes[$position] & 0xff;
??????? return $val;
??? }

??? /**
???? * 轉(zhuǎn)換一個shor字符串為byte數(shù)組
???? * @param $byt 目標byte數(shù)組
???? * @param $val 需要轉(zhuǎn)換的字符串
???? * @author Zikie
???? */
???
??? public static function shortToBytes($val) {
??? ??? $byt = array();
??? ??? $byt[0] = ($val & 0xff);
??????? $byt[1] = ($val >> 8 & 0xff);
??????? return $byt;
??? }
???
??? /**
???? * 從字節(jié)數(shù)組中指定的位置讀取一個Short類型的數(shù)據(jù)。
???? * @param $bytes 字節(jié)數(shù)組
???? * @param $position 指定的開始位置
???? * @return 一個Short類型的數(shù)據(jù)
???? */
????
??? public static function bytesToShort($bytes, $position) {
??????? $val = 0;
??????? $val = $bytes[$position + 1] & 0xFF;
??????? $val = $val ??????? $val |= $bytes[$position] & 0xFF;
??????? return $val;
??? }
???
}
?>

1 樓 tron.lu 2012-02-06??
3des 加密的時候用嗎?

2 樓 heaven__18 2012-03-13??
在很多地方都能用的到。
? ????? ??
? ?? ??? ????? ???? ??? ??????, ???? ?????? ????. ? ???? ?? ???? ?? ??? ?? ????. ???? ??? ???? ???? ??? ?? admin@php.cn?? ?????.

? AI ??

Undresser.AI Undress

Undresser.AI Undress

???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover

AI Clothes Remover

???? ?? ???? ??? AI ?????.

Video Face Swap

Video Face Swap

??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

???

??? ??

???++7.3.1

???++7.3.1

???? ?? ?? ?? ???

SublimeText3 ??? ??

SublimeText3 ??? ??

??? ??, ???? ?? ????.

???? 13.0.1 ???

???? 13.0.1 ???

??? PHP ?? ?? ??

???? CS6

???? CS6

??? ? ?? ??

SublimeText3 Mac ??

SublimeText3 Mac ??

? ??? ?? ?? ?????(SublimeText3)

???

??? ??

??? ????
1601
29
PHP ????
1502
276
???
HWID V 2.2 ?? ??? ?? ? ???? HWID V 2.2 ?? ??? ?? ? ???? Oct 20, 2023 pm 07:17 PM

?? ???? ??? ???? ?? ????. ? ??? ???? ? ??? ??? ?? ??? ???? ??? ?????. ?? ??? ????? ? ???? ?? ? ????. 1- ??? ?? ???? ???? ????? ??? ??????. ??? ???? Windows Powershell? ?? ??? ???? ??? ???? ??? ??????. ?? ?????(? ??? ?? ??). ?? ??? ?????. <key>slmgr/ipk<key> ???? ?? ??? ?????? ????? ??? ?????. ?? Powershell(Get-ItemProper)? ?? ??? ?????.

H5? ?? ??? ??? ?? ?? H5? ?? ??? ??? ?? ?? Dec 27, 2023 pm 01:05 PM

H5?? ?? ??? ???? ???? ?? H5 ????? ??? ?? ?? ? ????? ???? ??? ????. ?? CSS ?? ??? ???? ???. ?? ??? ?? ?? ??, ?? ?? ??, ?? ?? ?? ? ?? ?? ??? ???? ????? ??? ?? ??? ??? ? ????. ?? ???? H5 ???? position ??? ???? ???? ??? ??? ???????.

CSS ???? ?? ??? ?: ?? ? Flexbox ?? ?? CSS ???? ?? ??? ?: ?? ? Flexbox ?? ?? Oct 20, 2023 pm 03:15 PM

CSS ???? ?? ??? ?: positionsticky ? flexbox ? ???? ????? ?? ??? ?????. ?? ???? ??? ??? ??? ????? ???? ?? ???? ???? ?? ?? ? ????. CSS ???? ??? ? ??? ???? ? ?????. ? ????? ????? ???? ? ?? CSS ???? ?? ??? ??? positionsticky? flexbox? ???? ???? ?? ??? ?????. 1. ??

golang?? '???? ??: bytes.Split' ??? ???? ??? ?????? golang?? '???? ??: bytes.Split' ??? ???? ??? ?????? Jun 25, 2023 pm 02:02 PM

Go ???? bytes ???? ??? ??? ???? ?? ????? Split() ???? ?? ??? ???? ?? ?????. ??? Split() ???? ???? ?? "???? ??: bytes.Split" ??? ??? ? ????. ? ??? ????? Go ??? ???? ??? ??? ?? ?????? ???? ?????. ? ????? ? ??? ???? ? ?? ??? ?????. ?? 1: ??? ?? Go ??? ????????.

1???? ? ??? ????. 1???? ? ??? ????. Mar 19, 2021 pm 02:52 PM

1???? 8??? ????. ??? ??? "???"(Byte) ??? ?????, ??? ??? ??? "??"(bit) ??? ?????, 1??? 0 ?? 1(?, ????)? ????, 8??(bit)?? ) Byte? ??? ?? ?? ????? "1Byte=8bit"???.

h5?? ??? ???? ?? h5?? ??? ???? ?? Dec 26, 2023 pm 01:39 PM

H5??? position ??? ???? CSS? ?? ??? ?? ??? ??? ? ????. 1. ?? ?? ??, ??? "style="position:relative;"; 2. ?? ?? ??, ??? "style="position: ??;" "; 3. ?? ?? ??, ??? "style="position:fixed;" ????.

html?? div? ? ??? ?? ?? html?? div? ? ??? ?? ?? Mar 02, 2021 pm 05:44 PM

HTML ??? div? ???? ??: 1. "div{position:fixed;}" ??? ???? ?? ??? ???? ???? ?? ???? div ??? ?????. 2. ????? ??? ?????. 0 ??? ??? div? ????? ????? ??? "div{bottom:0;}"???.

Golang ?? ???, ?, ??? ?? ?? ?? Golang ?? ???, ?, ??? ?? ?? ?? May 17, 2023 am 08:21 AM

Golang ??????? ???, ? ? ??? ??? ?? ????? ???? ??? ?????. ??? ? ?? ???? ?? ??? ??? ???? ? ??? ??? ???. ??? ??? ??? ??? ? ????? ?? ???? ??, ?? ???? ?? ?? ??? ???? ???. ? ????? ??? ??? ??? ??? ? ? ???? ????? ??? ???? ??? ? ??? ?? ?? Golang ??? ???, ? ? ??? ?? ?? ??? ?????.

See all articles