Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81588 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 35033 invoked from network); 2 Feb 2015 14:31:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Feb 2015 14:31:01 -0000 Authentication-Results: pb1.pair.com smtp.mail=rdlowrey@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rdlowrey@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.223.177 as permitted sender) X-PHP-List-Original-Sender: rdlowrey@gmail.com X-Host-Fingerprint: 209.85.223.177 mail-ie0-f177.google.com Received: from [209.85.223.177] ([209.85.223.177:35790] helo=mail-ie0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 21/00-34915-32A8FC45 for ; Mon, 02 Feb 2015 09:31:00 -0500 Received: by mail-ie0-f177.google.com with SMTP id vy18so17767677iec.8 for ; Mon, 02 Feb 2015 06:30:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=TD2kxgWJivPeIx69pTQPfo+z4LJmfJWyGIAMyrV5XWM=; b=N6ey+nJwK27trQwbf0RNdIh7vnUuoIk+prdnsDa5TojHro7KXs6RvbOspnyVvl7d/D He2wHcMhmsWdlI7ONV4KQ+0OJxrwu1EmknmpQwOXPd+yAfZ6+jCGStkDLi4zncxBK0uu NClVUStULaS4EIYPJLJuS9W8owSVzqerJ66fyvswHsrgJ7PR8T7Ku7ZcN7FW+jE4WPNx mlAsC3hrh6rkQxDM5SLhjdkyHmacSryeoyCm24lxUnBHyERT1I3MymMlN48r0akZSMd2 i4QJbamAUlLWHhGxR3/BeRrGObNai1BJbN5nTBYV0N1egSapT89Dms6vO5OQs/Wc6kxF AA5A== MIME-Version: 1.0 X-Received: by 10.107.12.21 with SMTP id w21mr12190622ioi.28.1422887457056; Mon, 02 Feb 2015 06:30:57 -0800 (PST) Sender: rdlowrey@gmail.com Received: by 10.50.156.198 with HTTP; Mon, 2 Feb 2015 06:30:56 -0800 (PST) In-Reply-To: References: Date: Mon, 2 Feb 2015 09:30:56 -0500 X-Google-Sender-Auth: Kle-zuLLzJ7i4eHDWCrpAtPopHY Message-ID: To: Leigh Cc: "internals@lists.php.net" , Jakub Zelenka Content-Type: multipart/alternative; boundary=001a113ed8986eee6b050e1bcdbb Subject: Re: [PHP-DEV] Re: OpenSSL ext. improvements for authenticated cipher modes. From: rdlowrey@php.net (Daniel Lowrey) --001a113ed8986eee6b050e1bcdbb Content-Type: text/plain; charset=UTF-8 > The extra params aren't really _that_ bad. Okay, I'd like to reset the conversation a bit here. It's clear that the current API does not fit the problem domain very well. Tacking on more parameters only creates a bigger mess. Six parameters to a stateless function call is a completely incoherent API. It's unusable without consulting the manual. I think we need a completely different approach. Let me propose something else that won't break BC in any release and results in an API that's actually sane: class CryptoContext { private $mode; private $password; function __construct($mode, $password) { $this->mode = $mode; $this->password = $password; } function encrypt($data) { // ... return $encryptedData; } function decrypt($data) { // ... return $decryptedData; } function setOption($option, $value) { // ... } // more methods here to do anything you need } Thoughts on a stateful object API here? Personally I find this much more coherent than anything that's been proposed so far and it could be implemented without affecting existing functionality. --001a113ed8986eee6b050e1bcdbb--