com presentations: Add password_hash() example: sli des/intro/php55.xml

From: Date: Fri, 21 Jun 2013 18:54:37 +0000
Subject: com presentations: Add password_hash() example: sli des/intro/php55.xml
Groups: php.pres 
Request: Send a blank email to pres+get-1895@lists.php.net to get a copy of this message
Commit: 1e9ce79070000656634c31c7ed64c528f7ce4d27 Author: Rasmus Lerdorf <rasmus@php.net> Fri, 21 Jun 2013 11:54:37 -0700 Parents: 47bace634f9c98b05d41c58de5216e1ddc7ff704 Branches: master Link: http://git.php.net/?p=presentations.git;a=commitdiff;h=1e9ce79070000656634c31c7ed64c528f7ce4d27 Log: Add password_hash() example Changed paths: M slides/intro/php55.xml Diff: diff --git a/slides/intro/php55.xml b/slides/intro/php55.xml index 5f381ed..f8248ff 100644 --- a/slides/intro/php55.xml +++ b/slides/intro/php55.xml @@ -53,5 +53,16 @@ echo [1,3,4][2]; //output 4]]></example> <break lines="1" /> <blurb fontsize="4em">✔ Simplified password hashing API</blurb> +<example fontsize="2em" marginleft="7em" result='0' title=""><![CDATA[<?php +// Hash +$hash = password_hash("super secret password", PASSWORD_BCRYPT); + +// To validate $pwd against the stored hash +if (password_verify($pwd, $hash)) { + echo 'Password is valid!'; +} else { + echo 'Invalid password.'; +} +]]></example> </slide>

« previous php.pres (#1895) next »