随波逐流什么意思| 轻食是什么| 小猫感冒吃什么药| 身强力壮是什么生肖| 巡查是什么意思| 维生素c什么牌子好| 甲亢是什么回事| 奔跑吧 什么时候开播| 静怡是什么意思| 膝盖酸软是什么原因| 提前吃什么药喝酒不醉| 胆结石用什么药| 舌头有齿痕是什么原因| 男人后背有痣代表什么| 戏是什么生肖| 牛蒡是什么东西| 皮毒清软膏有什么功效| 内痔疮吃什么药好得快| 18k是什么意思| 非即食是什么意思| 舌根放血有什么好处| dior是什么意思| 输氨基酸对身体有什么好处和坏处| 什么驴技穷成语| 禁欲系是什么意思| 国家副主席是什么级别| 用什么泡脚能减肥| 释然是什么意思| 钢琴10级是什么水平| 老人家头晕是什么原因| 认知什么意思| 小孩晚上磨牙是什么原因引起的| 下肢动脉硬化吃什么药| 脚膜炎用什么药最好| 景象什么意思| 口吐白沫是什么生肖| 闲的蛋疼是什么意思| 心绞痛吃什么药最好| 下馆子什么意思| 铁树开花什么样| 碳酸饮料喝多了有什么危害| 胃胀气吃什么食物好| tst是什么意思| 极端是什么意思| 纹眉失败擦什么淡化| 牙龈肿痛吃什么药最见效| category是什么意思| 蓝莓有什么功效| 舌苔发黄是什么病| 吃什么能解酒| 大枣吃多了有什么危害| 什么叫做流年| 脚心发麻是什么原因引起的| rebecca什么意思| 女人八卦是什么意思| 棕色皮鞋配什么颜色裤子| 上海市委书记什么级别| 狗咬人后狗为什么会死| 丑时是什么时候| 手脱皮缺什么维生素| 双排是什么意思| 小孩小便红色是什么原因| 舌头上长泡是什么原因| 脑供血不足会导致什么后果| 颢读什么| 寂是什么意思| 1117什么星座| 松茸有什么功效| 心脏病人吃什么水果好| 三岁看小七岁看老是什么意思| 微光是什么意思| 中国信什么教| 什么是全脂奶粉| 马失前蹄下一句是什么| 喝茶心慌的人什么体质| 什么牌子空调好| 什么颜色加什么颜色等于绿色| 梦见床是什么意思| 阿胶补血口服液适合什么人喝| 什么茶叶好喝又香又甜| 奶冻是什么| 7月18日是什么日子| 藿香正气水不能和什么药一起吃| 新股配号数量是什么意思| 舌头白色是什么原因| 郁郁寡欢的意思是什么| 胃窦炎吃什么药效果最好| 超现实主义是什么意思| 动物的尾巴有什么作用| 牛皮和牛皮革有什么区别| 小孩腹泻吃什么药好得快| 大好河山是什么生肖| 4点是什么时辰| 减肥最好的办法是什么| 19时是什么时辰| 梦见自己生了个儿子是什么意思| 狗男和什么属相最配| 生孩子大出血是什么原因造成的| 肠胃不好吃什么| 吃牛油果有什么好处和坏处| 在什么| 煮花生放什么调料好吃| 玄牝是什么意思| 面部痒是什么原因| 95棉5氨纶是什么面料| 净身出户是什么意思| 肌红蛋白高是什么原因| 康斯坦丁是什么意思| 甘胆酸偏高是什么原因| 肺纹理增粗是什么意思| na是什么牌子| 尿糖2个加号是什么意思| 梦见缝被子是什么意思| 流量加油包是什么意思| 如是是什么意思| 什么水果热量低| 讲解是什么意思| 烧心吃什么药| 甘油三酯高应该注意什么| 类风湿和风湿有什么区别| 枸杞有什么作用| 舌头中间裂纹是什么病| 为什么清真不吃猪肉| 备孕需要做什么准备| 什么水果是热性的| 双五行属什么| 梦见发大水是什么意思| 什么是代谢| 胃疼什么原因| 布偶猫长什么样| ppl是什么意思| 黛力新主治什么病| 脖子上长癣是什么原因| sec是什么单位| 七月三十是什么星座| 喉咙发炎吃什么水果好| 日龙包是什么意思| 公安局跟派出所有什么区别| 中医学是什么| cop是什么意思| 1700年是什么朝代| 音什么笑什么成语| 左眼皮一直跳什么预兆| 吃维生素b有什么好处| 牛筋草用什么除草剂| 宫外孕术后可以吃什么| 抖m是什么| 请问尿路感染吃什么药最好| 刺梨根泡酒有什么功效| 养生馆起什么名字好| 泌尿外科是看什么的| 火腿肠炒什么好吃| 吃什么治便秘| 11什么意思| 雷锋属什么生肖| 默契的意思是什么| 红肉指的是什么肉| 大黄和芒硝混合外敷有什么作用| 坐卧针毡是什么生肖| 男生腿毛旺盛说明什么| 弱碱性水是什么水| 血糖和尿糖有什么区别| 代表什么意思| 知了猴吃什么长大的| vcr是什么| 什么是羊水栓塞| 血糖低怎么办吃什么补| 17楼五行属什么| 什么是代偿| 胡萝卜不能和什么食物一起吃| 憨笑是什么意思| 下巴底下长痘痘是什么原因| 噬是什么意思| 前列腺是什么东西| design是什么品牌| 想当演员考什么学校| 十一月六号是什么星座| 吉林有什么特产| et是什么| 人格分裂什么意思| 缺少电解质有什么症状| 宝宝发烧吃什么药| 卵巢保养吃什么好| 草龟吃什么蔬菜| 牙龈起包是什么原因| 梦见自己流血是什么预兆| 9月14号是什么星座| 慎什么意思| 心肌缺血是什么原因引起的| 什么汤是清热去火的| 木属于五行属什么| les什么意思| congee是什么意思| 孕妇d2聚体高是什么原因| rh阳性是什么意思| 退烧药吃多了有什么副作用| 猫的尾巴有什么用处| 狂蜂浪蝶是什么意思| 白细胞阳性是什么意思| 蚰蜒吃什么| 人为什么要工作| 成人自考本科需要什么条件| 预防脑血栓吃什么药好| 什么是果糖| 南京市徽为什么是貔貅| 月令是什么意思| 梦见自己嫁人了预示着什么| 关元穴在什么位置| 屋漏偏逢连夜雨是什么意思| 擦汗的表情是什么意思| 萎缩性胃炎能吃什么水果| 苯甲酸钠是什么东西| 宫颈机能不全是什么原因造成的| 停职是什么意思| 望尘莫及的及是什么意思| 得之坦然失之淡然是什么意思| 农历六月初四是什么日子| 什么叫血糖| 官宣是什么意思| 高高的什么| 什么样的白云| 人到无求品自高什么意思| 无毒不丈夫是什么意思| 脑梗吃什么最好| 牙髓是什么| 楚楚欲动是什么意思| 赛脸是什么意思| 经常拉肚子是什么原因引起的| 反流性食管炎吃什么中药| 日希是什么字| 捞女什么意思| 为什么会长牙结石| 金丝熊吃什么| 退行性改变是什么意思| 子宫癌有什么症状| 刘封为什么不救关羽| 脑膜炎是什么原因引起的| 牦牛角手串有什么作用| 发挥失常是什么意思| crayon是什么意思| 无回声结节是什么意思| 经信委是干什么的| 七一年属什么| 碱性磷酸酶偏高是什么原因| 猴子偷桃是什么生肖| 百合是什么植物| 农历6月21日是什么星座| 大姨妈吃什么水果最好| 吕洞宾属什么生肖| 痤疮涂什么药膏| 什么是中暑| 中华草龟吃什么| 梦见莲藕是什么意思| 福建为什么叫八闽| 梦见鬼是什么意思| 吃什么肉不会胖又减肥| 秋天什么水果成熟| 治胃病吃什么药| 46是什么意思| 吃瓜是什么意思| 时柱金舆是什么意思| 缺钾吃什么补得最快| 胸闷气短是什么原因造成的| 天涯是什么意思| 百度
rfc:rng_fixes

姚武江:“匠心”助力煤企转型

Introduction

百度 对此,西部创业表示,2017年经营业绩与2016年相比变动较大,得益于煤炭市场的回暖。

There are several long standing issues with random number generation that should be addressed:

  • Incorrect implementations
  • Platform-specific outputs
  • Poor scaling of bounded outputs
  • Insecure usage

Some of these fixes alter the output of the RNG or change the behaviour of functions that depend on them, so it makes sense to perform all of the changes at the same time.

Proposal

There are several proposals up for discussion.

  • Fix the current mt_rand() implementation, with the legacy implementation still available.
  • Alias rand() to mt_rand().
  • Fix RAND_RANGE for large ranges.
  • Replace insecure uses of php_rand() with php_random_bytes()
  • Make array_rand() more efficient
Fix mt_rand() implementation

The implementation of mt_rand() in PHP contains a typo that makes it generate a different sequence of numbers to the original mt19937 implementation. See bug #71152

Statistical analysis suggests that the quality of the output is unaffected.

As mt_rand() can be seeded for repeatable sequences the current implementation makes it incompatible with other systems that do use correct implementations. However fixing it also means that the sequence generated for a given seed in PHP will also now be different.

The legacy implementation will be preserved and be selectable with a new `mt_srand(int $seed [, int $mode])` parameter, along with new constants representing the two modes. The default will be the fixed algorithm.

Fix mt_rand() implementation
Real name Yes No
bishop (bishop)  
cmb (cmb)  
colinodell (colinodell)  
derick (derick)  
eliw (eliw)  
galvao (galvao)  
guilhermeblanco (guilhermeblanco)  
hywan (hywan)  
jhdxr (jhdxr)  
kguest (kguest)  
kinncj (kinncj)  
leigh (leigh)  
mariano (mariano)  
mbeccati (mbeccati)  
mike (mike)  
nikic (nikic)  
ocramius (ocramius)  
pajoye (pajoye)  
peehaa (peehaa)  
svpernova09 (svpernova09)  
trowski (trowski)  
tularis (tularis)  
tyrael (tyrael)  
zimt (zimt)  
Final result: 19 5
This poll has been closed.
Alias rand() to mt_rand()

rand() uses the system random number generator. The output of this RNG is system dependant and on many systems produces weak random numbers. (See bug #45301)

Aliasing it to mt_rand() improves the quality of the output and means the same output can be expected for a given seed regardless of platform.

Alias rand() to mt_rand()
Real name Yes No
bishop (bishop)  
cmb (cmb)  
colinodell (colinodell)  
derick (derick)  
eliw (eliw)  
galvao (galvao)  
guilhermeblanco (guilhermeblanco)  
hywan (hywan)  
jhdxr (jhdxr)  
kguest (kguest)  
kinncj (kinncj)  
leigh (leigh)  
mariano (mariano)  
mbeccati (mbeccati)  
mike (mike)  
nikic (nikic)  
ocramius (ocramius)  
pajoye (pajoye)  
peehaa (peehaa)  
stas (stas)  
svpernova09 (svpernova09)  
trowski (trowski)  
tularis (tularis)  
tyrael (tyrael)  
zimt (zimt)  
Final result: 21 4
This poll has been closed.
Fix RAND_RANGE()

The macro used to scale the output of an RNG between two bounds is insufficient for large ranges. (See bug #45184)

The proposed fix is to concatenate multiple outputs for ranges exceeding 32 bits, and use rejection sampling (the same as used in random_bytes()) to produce unbiased outputs.

Fix RAND_RANGE()
Real name Yes No
bishop (bishop)  
cmb (cmb)  
colinodell (colinodell)  
derick (derick)  
eliw (eliw)  
galvao (galvao)  
guilhermeblanco (guilhermeblanco)  
hywan (hywan)  
jhdxr (jhdxr)  
kguest (kguest)  
kinncj (kinncj)  
leigh (leigh)  
mariano (mariano)  
mbeccati (mbeccati)  
mike (mike)  
nikic (nikic)  
ocramius (ocramius)  
pajoye (pajoye)  
peehaa (peehaa)  
stas (stas)  
svpernova09 (svpernova09)  
trowski (trowski)  
tularis (tularis)  
tyrael (tyrael)  
zimt (zimt)  
Final result: 25 0
This poll has been closed.
Replace insecure uses of php_rand() with php_random_bytes()

There are several instances where rand() is used internally in a security sensetive context

  • crypt() salt generation
  • SOAP HTTP auth nonce generation

These instances should all be fixed to use the secure random number generator (even mcrypt which is deprecated)

Replace insecure uses of php_rand() with php_random_bytes()
Real name Yes No
bishop (bishop)  
cmb (cmb)  
colinodell (colinodell)  
eliw (eliw)  
galvao (galvao)  
guilhermeblanco (guilhermeblanco)  
hywan (hywan)  
jhdxr (jhdxr)  
kguest (kguest)  
kinncj (kinncj)  
leigh (leigh)  
mariano (mariano)  
mbeccati (mbeccati)  
mike (mike)  
nikic (nikic)  
ocramius (ocramius)  
peehaa (peehaa)  
stas (stas)  
svpernova09 (svpernova09)  
trowski (trowski)  
tularis (tularis)  
tyrael (tyrael)  
zimt (zimt)  
Final result: 23 0
This poll has been closed.
Make array_rand() more efficient

It has been noted that (array_rand() produces weird and very uneven random distribution). As the above proposals change the output of array_rand() anyway, we can fix this at the same time.

Make array_rand() more efficient
Real name Yes No
bishop (bishop)  
cmb (cmb)  
colinodell (colinodell)  
eliw (eliw)  
galvao (galvao)  
guilhermeblanco (guilhermeblanco)  
hywan (hywan)  
jhdxr (jhdxr)  
kguest (kguest)  
kinncj (kinncj)  
leigh (leigh)  
mariano (mariano)  
mbeccati (mbeccati)  
mike (mike)  
nikic (nikic)  
ocramius (ocramius)  
pajoye (pajoye)  
peehaa (peehaa)  
stas (stas)  
svpernova09 (svpernova09)  
trowski (trowski)  
tularis (tularis)  
tyrael (tyrael)  
zimt (zimt)  
Final result: 24 0
This poll has been closed.

Backward Incompatible Changes

A call to srand() or mt_srand() with a given seed will produce a different output in the following functions:

Proposed PHP Version(s)

7.1

RFC Impact

To SAPIs

None

To Existing Extensions

This is covered in the Backward Incompatible Changes section

To Opcache

None, this is a functional change, no changes to opcodes or code generation are required.

New Constants

MT_RAND_MT19937 (correct implementation mode) MT_RAND_PHP (unofficial implementation mode)

Open Issues

None

Proposed Voting Choices

Individual votes will be held for the remaining proposals, and since minor BC breaks are introduced they will require a 2/3 majority to pass.

Patches and Tests

Implementation

References

Rejected Features

None

rfc/rng_fixes.txt · Last modified: by 127.0.0.1

?
乳腺结节吃什么 pnc是什么意思 长红疹是什么原因 什么产品美白效果最好最快 日语一库一库是什么意思
膝盖内侧疼吃什么药 甲亢吃什么食物最好 吃什么补肾气 开学买什么 副鼻窦炎症是什么意思
物竞天择是什么意思 孕反什么时候结束 胃打嗝是什么原因 心脏早博是什么意思 7月15是什么节
蹦迪是什么意思 分割线是什么意思 什么是断掌 蒙古族的那达慕大会是在什么时候 乱伦是什么
文武双全是什么意思hcv8jop2ns0r.cn 胆固醇高是什么引起的hcv9jop2ns9r.cn 铁锈色痰见于什么病hcv7jop9ns5r.cn prn医学上是什么意思xinjiangjialails.com 女生什么时候容易怀孕hcv8jop0ns9r.cn
角瓜是什么hcv7jop6ns6r.cn 三点水翟读什么jiuxinfghf.com 情形是什么意思hcv9jop2ns8r.cn 156是什么意思hcv8jop5ns7r.cn 柏油是什么hcv7jop6ns8r.cn
konka是什么牌子hcv7jop6ns1r.cn 碳酸钙d3片什么时候吃最好hcv7jop5ns5r.cn 姨妈发黑量少什么原因shenchushe.com 潮湿是什么意思hcv7jop6ns4r.cn 感冒怕冷吃什么药hcv8jop1ns7r.cn
梨状肌综合症吃什么药hanqikai.com 胎儿头位是什么意思hcv8jop4ns7r.cn 手掌横纹代表什么意思hcv9jop5ns4r.cn 猪肚搭配什么煲汤最好hcv9jop1ns0r.cn 长白班是什么意思jasonfriends.com
百度