Re: [Cfrg] Analysis of ipcrypt?

Jean-Philippe Aumasson <> Thu, 22 February 2018 06:55 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id 0D35B12708C for <>; Wed, 21 Feb 2018 22:55:32 -0800 (PST)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -1.998
X-Spam-Status: No, score=-1.998 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: (amavisd-new); dkim=pass (2048-bit key)
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id tbPFA8VdZ7vk for <>; Wed, 21 Feb 2018 22:55:29 -0800 (PST)
Received: from ( [IPv6:2607:f8b0:400d:c0d::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by (Postfix) with ESMTPS id 6DCD91242EA for <>; Wed, 21 Feb 2018 22:55:29 -0800 (PST)
Received: by with SMTP id k13so5123023qtg.5 for <>; Wed, 21 Feb 2018 22:55:29 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=04pd0qYZX6Tpe7bwDXLNmHEKSZluft2aKVJfq4Vbo2k=; b=mzLQL+xXcKZQO1/a42cy0H8k1zI38UwJe3qyDzx15LAWmE78JcF6mM5zIlLPjlSyJr XTiDa8L+2E9+9UQxpHLRA2a1YK1tHlyIBTwKhOdTokVqUJZxUl8K+PnDNcw+5CdKSJFr Y88uN8+7vHlINvlylT2nyL2J4p5RzEvwFaFFrmWd3AnVLZThEuFR37JrsWlEpUVCj1qT 9FGrtHkm1UktM5RUz23KuOaUIhzqhZspYc2sxl9zmPNQ9DGYQC5yxRS5lWMGz0FpCmFL Hs5OQJ7iDKAiVSb9zcttQ7vPesKiHomEDnXGo3OgzsIKED18EuRRFszqWA4LBXB+bpMX H/ig==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=04pd0qYZX6Tpe7bwDXLNmHEKSZluft2aKVJfq4Vbo2k=; b=eKvxCG4Kvdjh+2A/DvaiG2kPyAn+aJbJyEAmvPgF6AhGofP/kx0GylpIEv7fwt6BlB wazAvDJy/W34aAcLwPDShx2JDPZifVxzTr2Cfh2MBsopmgzJz/v3YAr8TTb/9ZzcZRit YfMydjjl4VtY6mDkm2f1kg3qrtVWvOXPMQLBOMNU/CmsPiJ8OPTDEPAHQUMV1EbcTpAc kmU0gzGEBOIkWlJiAKbmKwJ9RxbdSWQFDnIFfDOOPYZgtCyM24lJBZjMbtXP38iacgyi 2DRKDqhba8rO8yb2jfzWa9NSeXi2cmk0MWIr1ZDPW1JlLd0PJFXzJrr1MKAUymjfkLUD VtbA==
X-Gm-Message-State: APf1xPC40Hm1LjSe3wptjGsSUVv/tIWvlWLPC6eyd7nwXtwId/LwgIkO KZOTi0JNdLcHJb8pOF+KuF1SiAd3t1UXzad4OHs=
X-Google-Smtp-Source: AH8x226dKUruZOjB9VFdwK0oOe4NfsklPXPayBU4GMWgAOwoafI/KElxbOlJtA6a8wuAZshjip9gl9kFVtM5ncYN/Y4=
X-Received: by with SMTP id u23mr9811950qte.235.1519282528360; Wed, 21 Feb 2018 22:55:28 -0800 (PST)
MIME-Version: 1.0
References: <>
In-Reply-To: <>
From: Jean-Philippe Aumasson <>
Date: Thu, 22 Feb 2018 06:55:17 +0000
Message-ID: <>
To: Paul Hoffman <>
Cc: "Jason A. Donenfeld" <>, "" <>
Content-Type: multipart/alternative; boundary="94eb2c1903186a9d130565c78715"
Archived-At: <>
Subject: Re: [Cfrg] Analysis of ipcrypt?
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: Crypto Forum Research Group <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Thu, 22 Feb 2018 06:55:32 -0000


I designed ipcrypt as a low-security toy cipher to encrypt IPv4 addresses
for some log analysis application. It may be good enough for this purpose,
however it has very low security:

* because of 32-bit blocks, a chosen-plaintext codebook attack will work in
time 2^32 (or much less for specific IP ranges)

* known-plaintext codebook attacks will work similarly but in O(n log n),
or 2^37 (coupon collector problem)

* there is a generic ~2^16 distinguisher that works by looking for a
collision in a sequence of blocks

* worse, Jason just found a high-probability differential that seems
detectable with fewer than 2^24 chosen-plaintext pair, and which may speed
up key recovery

On Thu, 22 Feb 2018 at 03:03, Paul Hoffman <> wrote:

> Greetings. ipcrypt is a format-preserving cipher for IPv4 addresses. It
> has a 32-bit blocksize for input and output, and 128-bit blocksize for the
> key. It was developed by Jean-Philippe Aumasson and is described at:
> There doesn't appear to be any formal paper describing the algorithm, but
> the Python and Go code is trivial to follow.
> This algorithm is now being considered by a few different projects that
> want to obfuscate IPv4 addresses. Has anyone analyzed the algorithm? I
> could not find analyses, but certainly could have missed them.
> For a project I'm on, ipcrypt is attractive if an attacker cannot derive
> the 128-bit random key without a lot (maybe 2^80ish) effort. For cases in
> common use, assume that the attacker has 2^24 known plaintext/ciphertext
> pairs under a single 128-bit random key. For additional ciphertexts, how
> much effort must the attacker expend to get the key in order to decrypt
> additional unknown ciphertexts?
> (Note that there are other options for this use case, which have different
> positive and negative features. What we'd like to know is how good is
> ipcrypt if we chose it.)
> --Paul Hoffman_______________________________________________
> Cfrg mailing list