PHP sha1

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

PHP : sha1() function

Last update on September 09 2017 06:08:52 (UTC/GMT +8 hours)

Description

The sha1() function is used to calculate the sha1 hash of a string.

Version

(PHP 4 and above)

Syntax

sha1(string1, raw_output)

Parameter

Name Description Required /
Optional
Type
string1 The input string. Required String
raw_output If TRUE sets raw 20 characters binary format. If FALSE (default) sets raw 40 character hex number format. Optional Boolean

Return value

Returns the sha1 hash as a string.

Value Type : String.

Example :

<?php $str = 'Good Morning'; echo sha1($str).'<br>'; echo sha1($str,TRUE).'<br>'; ?>

Output :

06e336231466d0b0573a05cbca7813444afb5b29
ã6#fаW:ËÊxDJû[)