[#31928] securerandom.rb for 1.8 — Tanaka Akira <akr@...>

securerandom.rb を 1.8 に追加し、cgi/session.rb に使わせたい

18 messages 2007/10/03
[#31990] Re: securerandom.rb for 1.8 — "Akinori MUSHA" <knu@...> 2007/10/09

At Wed, 3 Oct 2007 12:49:20 +0900,

[#31992] Re: securerandom.rb for 1.8 — Tanaka Akira <akr@...> 2007/10/09

In article <86k5pwinco.knu@iDaemons.org>,

[#31993] Re: securerandom.rb for 1.8 — "NAKAMURA, Hiroshi" <nakahiro@...> 2007/10/09

-----BEGIN PGP SIGNED MESSAGE-----

[#31936] Rake添付 — Yukihiro Matsumoto <matz@...>

まつもと ゆきひろです

21 messages 2007/10/04
[#31937] Re: Rake添付 — "NAKAMURA, Hiroshi" <nakahiro@...> 2007/10/04

-----BEGIN PGP SIGNED MESSAGE-----

[#31938] Re: Rake添付 — Yukihiro Matsumoto <matz@...> 2007/10/04

まつもと ゆきひろです

[#31941] Re: [ruby-list:44071] Re: Ruby 1.8.6-p111 / 1.8.5-p114 released (Security Fix) — Shugo Maeda <shugo@...>

前田です。

20 messages 2007/10/04
[#31943] Re: [ruby-list:44071] Re: Ruby 1.8.6-p111 / 1.8.5-p114 released (Security Fix) — "NAKAMURA, Hiroshi" <nakahiro@...> 2007/10/05

-----BEGIN PGP SIGNED MESSAGE-----

[#31945] Re: [ruby-list:44071] Re: Ruby 1.8.6-p111 / 1.8.5-p114 released (Security Fix) — Shugo Maeda <shugo@...> 2007/10/05

前田です。

[#31948] Re: [ruby-list:44071] Re: Ruby 1.8.6-p111 / 1.8.5-p114 released (Security Fix) — "NAKAMURA, Hiroshi" <nakahiro@...> 2007/10/05

-----BEGIN PGP SIGNED MESSAGE-----

[#31952] Re: [ruby-list:44071] Re: Ruby 1.8.6-p111 / 1.8.5-p114 released (Security Fix) — Shugo Maeda <shugo@...> 2007/10/05

前田です。

[#31956] Re: [ruby-list:44071] Re: Ruby 1.8.6-p111 / 1.8.5-p114 released (Security Fix) — GOTOU Yuuzou <gotoyuzo@...> 2007/10/06

In message <47063403.3070402@ruby-lang.org>,

[#31960] Re: [ruby-list:44071] Re: Ruby 1.8.6-p111 / 1.8.5-p114 released (Security Fix) — GOTOU Yuuzou <gotoyuzo@...> 2007/10/07

In message <20071006.101915.596518898.gotoyuzo@sawara.priv.tokyo.netlab.jp>,

[#31980] multibyte string/regex literal with escape sequence — "U.Nakamura" <usa@...>

こんにちは、なかむら(う)です。

24 messages 2007/10/09
[#31981] Re: multibyte string/regex literal with escape sequence — Yukihiro Matsumoto <matz@...> 2007/10/09

まつもと ゆきひろです

[#31983] Re: multibyte string/regex literal with escape sequence — "U.Nakamura" <usa@...> 2007/10/09

こんにちは、なかむら(う)です。

[#31984] Re: multibyte string/regex literal with escape sequence — Yukihiro Matsumoto <matz@...> 2007/10/09

まつもと ゆきひろです

[#31986] Re: multibyte string/regex literal with escape sequence — "U.Nakamura" <usa@...> 2007/10/09

こんにちは、なかむら(う)です。

[#31987] Re: multibyte string/regex literal with escape sequence — Yukihiro Matsumoto <matz@...> 2007/10/09

まつもと ゆきひろです

[#32003] Re: multibyte string/regex literal with escape sequence — "U.Nakamura" <usa@...> 2007/10/10

こんにちは、なかむら(う)です。

[#32133] undefined method `now' for DateTime:Class (NoMethodError) — "NAKAMURA, Hiroshi" <nakahiro@...>

-----BEGIN PGP SIGNED MESSAGE-----

12 messages 2007/10/23
[#32135] Re: undefined method `now' for DateTime:Class (NoMethodError) — tadf@... 2007/10/23

どういう状況かよくわかってないのですが、いっそ必ず date 丸ごと読むようにするか、

[#32136] Re: undefined method `now' for DateTime:Class (NoMethodError) — "NAKAMURA, Hiroshi" <nakahiro@...> 2007/10/23

-----BEGIN PGP SIGNED MESSAGE-----

[ruby-dev:32007] Re: securerandom.rb for 1.8

From: "Akinori MUSHA" <knu@...>
Date: 2007-10-10 04:16:25 UTC
List: ruby-dev #32007
At Tue, 9 Oct 2007 20:09:21 +0900,
Tanaka Akira wrote:
> In article <86k5pwinco.knu@iDaemons.org>,
>   "Akinori MUSHA" <knu@iDaemons.org> writes:
>
> >  いいと思います。ライブラリ名も明示的で納得できます。ただ、
> > メソッド名に random_ が付いたり付かなかったりする点が気になり
> > ます。
> >
> >  ruby-dev の議論は読んだんですが、メソッド名が決まった経緯は
> > 追い切れませんでした。こういうのはいまいちでしょうか。
> >
> > random_number(i)	-> integer
> > random_number(f=1.0)	-> float
> > random_bytes(n)		-> binary_string / string
> > hex(n)			-> hex_string
> > base64(n)		-> base64_string
>
> random_number は rand 互換で、SecureRandom が適切なケースで
> rand を使っていた、という場合に機械的に書き換えられるように、
> という意図です。でもそんなにお薦めではなく、hex や base64 を
> 使ってほしいので長い名前になっています。

 なるほど。まあ引数なしの呼び出しは検出しやすいので、メソッドを
分けてもさほど置き換えの障害にはならない気はしますが、とりあえず
そのままで。

> integer はあっていいかもしれませんが、用途はなんというか
> session id とかよりはもっと専門的なものになる気がします。
> 見識があるひとに必要性を説かれてからで遅くないように思います。
>
> float は (上記の書き換え以外では) ちょっと用途が思い当たりま
> せん。

 そうですね。

> random_bytes は OpenSSL::Random.random_bytes に由来します。
> bytes にしようかと考えたこともありますが、[ruby-dev:31515]
> のように IO#bytes と Random#bytes で違うのでどうしたものかなぁ
> と思いつつ、random_bytes 自体はそんなに使いやすくなくてもい
> いか、ということでそのままになっています。

 わかりました。

> binary_string, string は別名としてありうると思います。

 bytes と呼ぶものを string とも呼べるいうのはやはりよくないし、
binary_string と言うくらいなら random_bytes でいいので撤回します。

> hex と base64 が短いのは意図的です。これらを使いましょうとい
> う推奨を示しています。

 たくさんの箇所で使うものでもなさそうなので長くてもいいと思い
ますが、誤解は生じないと思うので納得しました。


 String#hexencode や String#base64encode が組み込みであっても
いい気がしますが、それは別の話。

--
                     /
                    /__  __            Akinori.org / MUSHA.org
                   / )  )  ) )  /     FreeBSD.org / Ruby-lang.org
Akinori MUSHA aka / (_ /  ( (__(  @ iDaemons.org / and.or.jp

"Different eyes see different things,
    Different hearts beat on different strings --
       But there are times for you and me when all such things agree"

In This Thread