220 12452 <53F9DB1E.1020803@gmx.net> article
Path: news.gmane.org!not-for-mail
From: Jens Maurer <Jens.Maurer@gmx.net>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Cryptographic hash functions reloaded [was
 Interest in cryptographic functions within the standard library]
Date: Sun, 24 Aug 2014 14:31:26 +0200
Lines: 58
Approved: news@gmane.org
Message-ID: <53F9DB1E.1020803@gmx.net>
References: <53F8F620.3090701@gmx.de> <53F9AAF7.8030602@gmx.de>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
X-Trace: ger.gmane.org 1408883498 30427 80.91.229.3 (24 Aug 2014 12:31:38 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sun, 24 Aug 2014 12:31:38 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDPMTYGK64JRBINW46PQKGQEDLFBSQI@isocpp.org Sun Aug 24 14:31:31 2014
Return-path: <std-proposals+bncBDPMTYGK64JRBINW46PQKGQEDLFBSQI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wi0-f200.google.com ([209.85.212.200])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDPMTYGK64JRBINW46PQKGQEDLFBSQI@isocpp.org>)
	id 1XLWxH-0005cF-6O
	for gclcip-std-proposals@m.gmane.org; Sun, 24 Aug 2014 14:31:31 +0200
Original-Received: by mail-wi0-f200.google.com with SMTP id d1sf711789wiv.11
        for <gclcip-std-proposals@m.gmane.org>; Sun, 24 Aug 2014 05:31:30 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to
         :subject:references:in-reply-to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe:content-type;
        bh=wrIt8r4q5GsN5r2akkLGEGLczV6Q2YHQpTr+/cF3vIU=;
        b=SVvT+D0dAPtJ8FH9ovW1B6I0K0J604fmJBVpYXScsVjtMPDrlqm4imaHLPJUO2ZYMh
         ZB+m2Qw9SDRfSfA/LBNKshuCP9I2fOEPubaJ8GaMm/fVYzx4dtMpyeP4Qh9tADpqhJ9F
         eEK7hmewqwGtUMaavjgFQ2c2LsddgSmMqkSSI3HD8QlXydCVnvV8/S6cgpQupdCXBob9
         AWRFWX40vDv7pSLp/HKF+FigwkZFFcyKiLGVyGq2624WuHP3tbdIuU6kc1LPBMAQGD25
         h/mOAyXo/rwl1E1SkmtBzn65kttsmgY9Q+K9wOWsivzYMG0oG1nhUujwYxBD9K7ujHsl
         VyLQ==
X-Gm-Message-State: ALoCoQmNLawB5D+wxLeDW+A8y1L09G6v+Kq0ccUhAHwOcJv+UIFym5rYYWB4Qi8qs1h7jqEOU5om
X-Received: by 10.180.198.172 with SMTP id jd12mr725516wic.6.1408883490506;
        Sun, 24 Aug 2014 05:31:30 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.152.115.212 with SMTP id jq20ls16960lab.38.gmail; Sun, 24 Aug
 2014 05:31:28 -0700 (PDT)
X-Received: by 10.152.229.133 with SMTP id sq5mr2710504lac.67.1408883488903;
        Sun, 24 Aug 2014 05:31:28 -0700 (PDT)
Original-Received: from mout.gmx.net (mout.gmx.net. [212.227.15.15])
        by mx.google.com with ESMTPS id f2si9379563laf.0.2014.08.24.05.31.28
        for <std-proposals@isocpp.org>
        (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Sun, 24 Aug 2014 05:31:28 -0700 (PDT)
Received-SPF: pass (google.com: domain of Jens.Maurer@gmx.net designates 212.227.15.15 as permitted sender) client-ip=212.227.15.15;
Original-Received: from [192.168.2.100] ([178.7.39.200]) by mail.gmx.com (mrgmx002)
 with ESMTPSA (Nemesis) id 0Me8RK-1WytF00Yr0-00PuIc for
 <std-proposals@isocpp.org>; Sun, 24 Aug 2014 14:31:28 +0200
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:6.0.1) Gecko/20110830 Thunderbird/6.0.1
In-Reply-To: <53F9AAF7.8030602@gmx.de>
X-Provags-ID: V03:K0:nR+iMtlVkmULBFL00fZq4OePg3HMu9KWWzZ7pTh+ZRAYAWg6oxd
 +VDp8B0LMVnxNkU5INULsYcA+NVzuG3UEI/bGudIukssOaCqLQtyy9kkYq+3wION6CzgYHl
 +0uIIezvAs9PoRcZtOCZjALnvlMJk0xwzckQfn4EZ5rRd09Ren8OS+UDXLPV/KJWWZI/bbR
 pv/mAGk/nBA4yYqOFzosg==
X-UI-Out-Filterresults: notjunk:1;
X-Original-Sender: Jens.Maurer@gmx.net
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of Jens.Maurer@gmx.net designates 212.227.15.15 as permitted sender) smtp.mail=Jens.Maurer@gmx.net
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:12452
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/12452>

On 08/24/2014 11:05 AM, Markus Mayer wrote:
> class hash_function
> {
> public:
>    typedef std::array<unsigned char, ALGORITHM_DEFINED> result_type;
>    //Default contructable
>    //Copyable
>    //Moveable
> 
>    hash_function& process_bytes( void unsigned char *buffer, std::size_t 
> byte_count);
> 
>    hash_function& operator() ( void unsigned char *buffer, std::size_t 
> byte_count);

Remove the "void".

Remove "process_bytes()", it's redundant.

>    void reset();
> 
>    result_type hash_value() const;

I've got a slight preference towards a named "result" function,
but I can also live with the explicit conversion operator.

> -How to hash a files?
> Hashing a file is quite common. As the iterator interface was removed, 
> there is no easy way to hash a file (using istream_iterator). How to do 
> it now?

Provide a thin wrapper template that processes input iterators
in e.g. 1024-byte chunks.
 
> -Should we only add some crc classes (like crc_32, crc_16 or crc_ccitt) 
> or a an generic (templated) crc algorithm (like in boost:crc)?

I've no objection against providing a fully general CRC capability,
but I'd like to see a typedef for at least crc32c, since Intel has
a hardware instruction for this that asks for specialization.

> -Find a suitable header file (maybe functional or algorithm)

I'd be inclined to ask for a separate header file.

Are there any legal restrictions on secure hash functions somewhere?
There are definitely some for encryption algorithms in some places.

Jens

-- 

--- 
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.
