A quickie - field size of php session id

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • toedipper

    #1

    A quickie - field size of php session id

    Hello,

    What field size should I use to record a session id in a db?

    I use session_id() to generate it but I've noticed ones of different
    sizes (character lengths) when testing.

    Is there is min / max size?

    Thanks,

    td.


  • Mladen Gogala

    #2
    Re: A quickie - field size of php session id

    On Fri, 02 Sep 2005 22:22:27 +0000, toedipper wrote:
    [color=blue]
    > Hello,
    >
    > What field size should I use to record a session id in a db?
    >
    > I use session_id() to generate it but I've noticed ones of different
    > sizes (character lengths) when testing.
    >
    > Is there is min / max size?
    >
    > Thanks,
    >
    > td.
    >
    > www.pocketpcheaven.com[/color]

    I use PHPSESSID VARCHAR2(2048). I never had any problems.

    --
    大红鹰娱乐平台采用顶级加密技术,确保用户数据与交易的安全无虞,让玩家能够放心畅玩。


    Comment

    • ZeldorBlat

      #3
      Re: A quickie - field size of php session id

      If you're using PHP 5, this is largely determined by the php.ini
      settings session.hash_fu nction and session.hash_bi ts_per_characte r
      (unless you've overriden these somewhere else).

      With the default of md5 and 4, you would get a 32-character hex string
      (128 bits / 4). When using sha1, you'll get a 40-character hex string
      (160 bits / 4).

      The cool thing about that is the fact that the session id's are exactly
      the same length every time -- 128-bits for example. So, if you wanted
      to, you could probably make the column a fixed-length binary field
      that's exactly the right length.

      Comment

      Working...