Monday, October 31, 2016

/dev/random vs. /dev/urandom

There's no noticeable difference of the speed between '/dev/random' and '/dev/urandom' in MacOS as follows::

$ time head -n 1 /dev/random
?^??ݣ??%???8W?~G???Y??m5?
?w?\:b??"?d>r?A?tۦ??9?   k?o??&?%>M10ݠ??M?yH??

real    0m0.010s
user    0m0.001s
sys 0m0.008s
$ time head -n 1 /dev/urandom
,}8????
       ?G^??x??#~?o??%?\?$?PѠr۾????8cT?ښ??????Po??P??Ѐ?0??G??%? ?%.'    ?-Z??(????ϣ?1=??G????Tn?C%?C;?Uߌ?&P?*+C?^??x?L

                                      ??7?g??N_?e?????ļ?k??êN??M?!?@a???  ?tW??"?7R?`?V???VOjD
                  ?ۮj??U???D2?{׍{|
                                    ?\?΢??v2?9n?ZUC'
                                                        ??F&? B???D?/?/}???I???Rk?O?8?Q?K?ݮ?#:ZE?.?@rR=B?l?H?m?

real    0m0.010s
user    0m0.001s
sys 0m0.008s
$

but there's big difference in CentOS as follows:

$ time head -n 1 /dev/random
?I?[k+???ത?y??c?Ϛ-%#M?_?{|?????c?$??^      '>e.    ??.?ӺQێ5o?q?????f8?-<?]ß"?d*i;u@?9r^??`VYyrJ??V?W?[8??$c?O???q/?;QP?p?
                                         ????#&i0?z???<v?ⁱ???̵VH:x??%uТ????hPU?R???`??djԹc?c?   Hz4?a@+?ƹqX???5V??[J
                                   ?發??7AΟbvy]E2?ݍ??4k?'MR??????k#?F????x?)vж??p?-??f%?$7??t?qd?"?<?T?'t~S?@?H?}JA?g???:@b??vԆ@???#??????fZ?j?+?t??J??M ?X?w??I=Kj?yfC
       J(0???MVl????????/N???ަ??yI??1

real    0m43.838s
user    0m0.001s
sys     0m0.004s
$ time head -n 1 /dev/urandom
?1Q:?{?GS?pX?K??,oW%?????????
?ERʧ??????'?N???;@Lvg????T?0???9RZ??ܓ
                                     ???&?????aŃ@?Y???L??WM?O~?,V?h<?3?ļ?j
??!?zdw?-a?????߈?¿ͯ^?Ɍ`tx?d??uN?qO?b?????j?s&A?e?d$?~??24w?_[Da???x???s?5??????????ZR~?,??       *??I?????L???yb7??3vqU???Cଆ~?YN톾?]7n?Q???px[]??ي{??F?- '??+?nDQ??:*?U????̼??hm*F??$<??1;?ؓ??\?.??Cݽ?R???I:?Hq?@?????Ab???(??Vϕɫga?O?ޱz??'??d~M?Z?g?Z???Z??f^ Yv?}?/?@??)N7=?5???0ļJ?n|??M??*??7[???????<?6
                                                         ?%???b????5l???? v?+4k??X?*^+??k????J"??>??s}F?H?-??m

real    0m0.004s
user    0m0.001s
sys     0m0.002s
$

Reference:
https://docs.oracle.com/cd/E13209_01/wlcp/wlss30/configwlss/jvmrand.html

No comments:

Post a Comment