15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2011 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef NET_HTTP_DES_H_
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define NET_HTTP_DES_H_
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/basictypes.h"
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "net/base/net_export.h"
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace net {
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//-----------------------------------------------------------------------------
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// DES support code for NTLM authentication.
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// TODO(wtc): Turn this into a C++ API and move it to the base module.
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Build a 64-bit DES key from a 56-bit raw key.
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)NET_EXPORT_PRIVATE void DESMakeKey(const uint8* raw, uint8* key);
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Run the DES encryption algorithm in ECB mode on one block (8 bytes) of
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// data.  |key| is a DES key (8 bytes), |src| is the input plaintext (8
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// bytes), and |hash| is an 8-byte buffer receiving the output ciphertext.
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)NET_EXPORT_PRIVATE void DESEncrypt(const uint8* key, const uint8* src,
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                   uint8* hash);
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // namespace net
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  // NET_HTTP_DES_H_
30