<s>
In	O
cryptography	O
,	O
the	O
Salted	B-Protocol
Challenge	I-Protocol
Response	I-Protocol
Authentication	I-Protocol
Mechanism	I-Protocol
(	O
SCRAM	O
)	O
is	O
a	O
family	O
of	O
modern	O
,	O
password-based	O
challenge	O
–	O
response	O
authentication	O
mechanisms	O
providing	O
authentication	O
of	O
a	O
user	O
to	O
a	O
server	O
.	O
</s>
<s>
As	O
it	O
is	O
specified	O
for	O
Simple	O
Authentication	O
and	O
Security	O
Layer	O
(	O
SASL	O
)	O
,	O
it	O
can	O
be	O
used	O
for	O
password-based	O
logins	O
to	O
services	O
like	O
SMTP	B-Protocol
and	O
IMAP	B-Protocol
(	O
e-mail	O
)	O
,	O
XMPP	B-Protocol
(	O
chat	O
)	O
,	O
or	O
MongoDB	B-Application
and	O
PostgreSQL	B-Application
(	O
databases	O
)	O
.	O
</s>
<s>
For	O
XMPP	B-Protocol
,	O
supporting	O
it	O
is	O
mandatory	O
.	O
</s>
<s>
Therefore	O
,	O
Alice	O
sends	O
a	O
hashed	O
version	O
of	O
her	O
password	O
instead	O
,	O
like	O
in	O
CRAM-MD5	O
or	O
DIGEST-MD5	B-Protocol
.	O
</s>
<s>
For	O
solving	O
this	O
,	O
Bob	O
has	O
registered	O
himself	O
to	O
a	O
certificate	B-Architecture
authority	I-Architecture
(	O
CA	O
)	O
,	O
which	O
signed	O
his	O
certificate	O
.	O
</s>
<s>
DIGEST-MD5	B-Protocol
already	O
enabled	O
mutual	O
authentication	O
,	O
but	O
it	O
was	O
often	O
incorrectly	O
implemented	O
.	O
</s>
<s>
He	O
has	O
heard	O
of	O
the	O
CRAM-MD5	O
and	O
DIGEST-MD5	B-Protocol
login	O
schemes	O
,	O
but	O
he	O
knows	O
,	O
for	O
offering	O
these	O
login	O
schemes	O
to	O
his	O
users	O
,	O
he	O
would	O
have	O
to	O
store	O
weakly	O
hashed	O
,	O
un-salted	O
passwords	O
.	O
</s>
<s>
Then	O
he	O
can	O
hash	O
them	O
with	O
secure	O
hashing	O
schemes	O
like	O
bcrypt	B-Algorithm
,	O
scrypt	B-Algorithm
or	O
PBKDF2	O
,	O
and	O
salt	O
them	O
as	O
he	O
wants	O
.	O
</s>
<s>
Although	O
all	O
clients	O
and	O
servers	O
have	O
to	O
support	O
the	O
SHA-1	B-Algorithm
hashing	O
algorithm	O
,	O
SCRAM	O
is	O
,	O
unlike	O
CRAM-MD5	O
or	O
DIGEST-MD5	B-Protocol
,	O
independent	O
from	O
the	O
underlying	O
hash	O
function	O
.	O
</s>
<s>
'	O
SCRAM-SHA-1	B-Protocol
'	O
for	O
instance	O
,	O
uses	O
SHA-1	B-Algorithm
as	O
hash	O
function	O
.	O
</s>
<s>
SaltedPassword	O
=	O
H(password, salt, iteration-count )	O
=	O
PBKDF2(HMAC, password, salt, iteration-count, output length of H )	O
.	O
</s>
<s>
where	O
the	O
XOR	B-Application
operation	O
is	O
applied	O
to	O
byte	O
strings	O
of	O
the	O
same	O
length	O
,	O
H(ClientKey )	O
is	O
a	O
normal	O
hash	O
of	O
ClientKey	O
.	O
</s>
<s>
An	O
example	O
use	O
case	O
of	O
channel	O
binding	O
with	O
SCRAM	O
as	O
application	O
layer	O
,	O
could	O
be	O
with	O
Transport	B-Protocol
Layer	I-Protocol
Security	I-Protocol
(	O
TLS	O
)	O
as	O
lower	O
layer	O
.	O
</s>
<s>
Channel	O
binding	O
is	O
optional	O
in	O
SCRAM	O
,	O
and	O
the	O
gs2-cbind-flag	O
variable	O
prevents	O
from	O
downgrade	B-Protocol
attacks	I-Protocol
.	O
</s>
<s>
Simplicity	O
:	O
Implementing	O
SCRAM	O
is	O
easier	O
than	O
DIGEST-MD5	B-Protocol
.	O
</s>
