From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by c5ff346549e7 (Postfix) with ESMTPS id CA41F1E5 for ; Thu, 28 Mar 2019 21:26:34 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.60,281,1549926000"; d="scan'208,217";a="376234040" Received: from sympa.inria.fr ([193.51.193.213]) by mail2-relais-roc.national.inria.fr with ESMTP; 28 Mar 2019 21:41:15 +0100 Received: by sympa.inria.fr (Postfix, from userid 20132) id 8BCA38267B; Thu, 28 Mar 2019 21:41:15 +0100 (CET) Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 373A38249D for ; Thu, 28 Mar 2019 21:41:06 +0100 (CET) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=helmut.brandl@gmx.net; spf=Pass smtp.mailfrom=helmut.brandl@gmx.net; spf=None smtp.helo=postmaster@mout.gmx.net IronPort-PHdr: =?us-ascii?q?9a23=3AqyOtWxVdQnDkLYqcjLqd8ATxtwzV8LGtZVwlr6E/?= =?us-ascii?q?grcLSJyIuqrYYxyHt8tkgFKBZ4jH8fUM07OQ7/m4Hzxcqs/a4TgrS99lb1c9k8?= =?us-ascii?q?IYnggtUoauKHbQC7rUVRE8B9lIT1R//nu2YgB/Ecf6YEDO8DXptWZBUhrwOhBo?= =?us-ascii?q?KevrB4Xck9q41/yo+53Ufg5EmCexbal9IRmrsQndrMobjIRtJqosxBbEpmZDdv?= =?us-ascii?q?hLy29vOV+dhQv36N2q/J5k/SRQuvYh+NBFXK7nYak2TqFWASo/PWwt68LlqRfM?= =?us-ascii?q?TQ2U5nsBSWoWiQZHAxLE7B7hQJj8tDbxu/dn1ymbOc32Sq00WSin4qx2RhLklD?= =?us-ascii?q?sLOjgk+2zMlMd+kLxUrw6gpxxnwo7bfoeVNOZlfqjAed8WXHdNUtpNWyBEBI63?= =?us-ascii?q?cokBAPcbPetAs4byqEYAoxu8CgeiB+3vxCFGiHjt0KIgz+ghFBvL3Aw8E94Qtn?= =?us-ascii?q?nfsdX7NL0VUeCw1KTGzyvMb/dT2Tfg9IjDbw0soeuWUrJ2bMXRzVQkGgTFjlqO?= =?us-ascii?q?rYzlOi6V1vgXv2eA9epvT+SvhHMjqwxqrTivw8gthpPPho0L1lDJ7CN0y5s2K9?= =?us-ascii?q?2gUEN3f8OoHIVKuy2EKYd7QNkuT3xqtSog1LEKpIa3cDUJxZkl3RLTdeGLfoqS?= =?us-ascii?q?7h7+UOucIS10iX1jdbminRi961Kgxff5VsSs0FZFsC5Fkt7Uu3AI0BzT99SHRu?= =?us-ascii?q?Fy/kek1jeDzQbT5f9YIUwslKrbLYAuwqIom5YNrEjPADX6lFvogKKUbEko5+ql?= =?us-ascii?q?5/75brn7vpOcMpV7igD6MqQggMy/BuE4PxAOX2eF/eS80aDj/VHjTLpRlP05iK?= =?us-ascii?q?/Zv43eJckAqa65BgBU3pwl6xmhEzeqyM4YkmUfLFJZZBKHiJDkNE3UL/D9Cfez?= =?us-ascii?q?mlCskDZwx/DaJbDhGZXMLn3bkLj7Z7p96khcyBAyzd9F/Z5UBKsBc7rPXRrUvc?= =?us-ascii?q?DEDhImezalyuCvXNB0yp8eVH2nBfadOanJ91iS6bR8DfOLYdo1tTL4NuRtzeTn?= =?us-ascii?q?i3M90QsdcK2swIdRYmqxGPhiC0qccTzqj8tXQjRChRY3UOG/0A7KajVUfXvnGv?= =?us-ascii?q?tkvmhqWrLjNp/KQ8WWuJLE2S66GpNMYWUXWF+JATHuepnWAq5QOhLXGddol3k/?= =?us-ascii?q?bZbkU5UohEOhsR+8zbd7fLKNp38o8Kn73d0w3NX90BE/8TstU5aY1HyRCW5xji?= =?us-ascii?q?UOSiNkhK0=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0D2AQDBMJ1cgBUR49RlGwEBAQEDAQEBB?= =?us-ascii?q?wMBAQGBZYJ8gQAnkC2HI4FoJYNdhWyQbg8rAYRAAoU0GgcBBDQSAQEDAQEJAQM?= =?us-ascii?q?BAQETAQEJDQkIJyUMgjopAYJmAQEBAwFAAQE3AQQLCwQUGA8HRgMBDQYTgyKBX?= =?us-ascii?q?QEDDQoCn0GKLIIggngBAQWCR4F0AUoDgiEIgS+EXYZVgVc/gREnDBOCHi4+gQQ?= =?us-ascii?q?BgRWCeYJsgiaSRYYji2ZgBwKBdFcEkRKCA4kpJog6m3SDGoFkgXczGi5FKgGCQ?= =?us-ascii?q?T6BTBiIL4YZIDOBBQEBjEWCKQEB?= X-IPAS-Result: =?us-ascii?q?A0D2AQDBMJ1cgBUR49RlGwEBAQEDAQEBBwMBAQGBZYJ8gQA?= =?us-ascii?q?nkC2HI4FoJYNdhWyQbg8rAYRAAoU0GgcBBDQSAQEDAQEJAQMBAQETAQEJDQkIJ?= =?us-ascii?q?yUMgjopAYJmAQEBAwFAAQE3AQQLCwQUGA8HRgMBDQYTgyKBXQEDDQoCn0GKLII?= =?us-ascii?q?ggngBAQWCR4F0AUoDgiEIgS+EXYZVgVc/gREnDBOCHi4+gQQBgRWCeYJsgiaSR?= =?us-ascii?q?YYji2ZgBwKBdFcEkRKCA4kpJog6m3SDGoFkgXczGi5FKgGCQT6BTBiIL4YZIDO?= =?us-ascii?q?BBQEBjEWCKQEB?= X-IronPort-AV: E=Sophos;i="5.60,281,1549926000"; d="scan'208,217";a="301086916" X-MGA-submission: =?us-ascii?q?MDE9OV7/HLgZ+Sj59TqnhxG1VJc0CzssyhsubM?= =?us-ascii?q?nCRM49KclFuQzA80usR3oKN3PYSOQs6JWpEI4x+TBkCtPebxnRn+8bQZ?= =?us-ascii?q?+14WpW2qBq2+raKuuu+XLnDZGeGaSZuOKJ9pfVXInDar960NfPAPaOjK?= =?us-ascii?q?WCg73zUtrs4jMYrzrVZuVJoQ=3D=3D?= Received: from mout.gmx.net ([212.227.17.21]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES128-GCM-SHA256; 28 Mar 2019 21:41:05 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1553805663; bh=uG1m+6cgJ7yDNuNuMobg2pku1tfl0s5DTcA09N7Uv8E=; h=X-UI-Sender-Class:Subject:From:In-Reply-To:Date:Cc:References:To; b=imFdceqmlwH36AZzNK8lUkYwv5GH/O2QKvrJ//9nr6cJ3I81vxHUu5tWLbC46taOJ NYvHDMbckzUX4ELb01KqvmWHYcNoOeHWOZbE9pfXQhlNunFQpFWXBUuEYkobpioYev NT/dAi3LWxwsFp1/qRVK9hv1PWOuA7W2BZV56hw0= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.43.77] ([187.217.195.4]) by mail.gmx.com (mrgmx101 [212.227.17.168]) with ESMTPSA (Nemesis) id 0LqE5k-1gW8HG36My-00dktW; Thu, 28 Mar 2019 21:41:03 +0100 Content-Type: multipart/alternative; boundary="Apple-Mail=_8DAA0056-F876-4EBE-9928-0F98CD1F9702" Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) From: Helmut Brandl In-Reply-To: Date: Thu, 28 Mar 2019 14:40:57 -0600 Cc: caml users Message-Id: References: <21AC2517-8185-45A3-8520-53C92761CBBA@gmx.net> To: Matthew Ryan X-Mailer: Apple Mail (2.3445.102.3) X-Provags-ID: V03:K1:YrYqSStgWTkl5CkWyF1sJsa5SCsz9ZGG6Y0Z12AeHuQ+8AZOzNG dXcJJb9LwPLhuhFZWfjrkGTf1ABmZB+WnAunYyHDANfO4JIexbG9aVsEzgUoI8sTMhiJm+u piYB6doOJMEqAtjw0/DnWzbcAH4PfouqOqzTjANHKmKpypNsLFElX3WtO5iw8tPqTo354Rb V4TAb9hcaboM2rW5PsWQQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:WJqZqLUiCX8=:UjjT/kG64LjkSL5ef10lGE JguXPhVS8cbQ2VxOEpUoDUlb8NaR/5Yl87VPGQzKkrA503ETv8hRd0OgRYtaluOg5IxfFdBcX OTL1x+FGjt87jCPvPbThd4HzB0hNu/yjIxtdF0hSt8/Ssve8+TLlS0WP1/FhIlnVqBUjrlOWj IMTPihxdKkJWyMAeeM9cC3fHhV6R6bLJEh9dldDLzPBEwPaHeApMYBSc5ZOkEQs3QrzR8dXNa zPXtSedz+gzum0BiR8xNUu2C0mxNiFWTsbLqOkTv1+5IowXX3mwXTjKv6qO3j0kCAUiXYq0Nz CGKT8HFXzwkITZ8Y7gamSP6M9ZxsnwSxAR7NciyWS+GulLr0IYgSNTE8gDH3veYnFOmNGiIfS alYFDMKgJcwpbt7GuWKslTe98jxheTQnw3NfedoyKYOry852Eic7HIP0J0oWDIjpsU3Xx+owv rqkHdjKIqI+DqNvHR1v7Y16YG9pU55ZAHgAnJCgVXrb92gFHd7cXFJrbVQwj/jhrBuErGmZUK n9YL/BTh74Zi1Sqr+VM7j/V6zXfNl/5ZZAuFgwJuoKQxmYg7YdRQUP1Q8vj0FjNNvnbvvt3vp nnvWztxcxkaqgfdIsgke2BcEyqviAQfdrexfArXac0JelUvnRB3yrGkfXFTul4mg4PqQ6ajeN A3azENsIezYmk6b6/H8QTfyQYinHnYNdD3bRhQzmf8BewysX7UohyaqPwLi90wfmrsCI/V2Vk cRx5wcELna1A1x+HqenaJ9JKn3XZWS4uRjB7GYzGu1BYfuw6Zonr/FszFCE/EU71QqSAxUT2g c4Um1fy0Hs/RkP/8tgTb716QvhRdiXC4zuYmrXYziE+cvpnkFOWSew39CZexbvFtyRU3HAP/P oyZEEcxANG4dm3YVKj5bl77r/57NfNnIOjkMdhf4t4y88plJXhLjxvBOK3O8Uzfv4BcwfboJM IaC4dmuAcRKvpz1tFuT4Bz7DQHnqqLlM= Subject: Re: [Caml-list] Turn echoing off on standard input to read e.g. passwords Reply-To: Helmut Brandl X-Loop: caml-list@inria.fr X-Sequence: 17441 Errors-to: caml-list-owner@inria.fr Precedence: list Precedence: bulk Sender: caml-list-request@inria.fr X-no-archive: yes List-Id: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --Apple-Mail=_8DAA0056-F876-4EBE-9928-0F98CD1F9702 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Thanks. > On Mar 28, 2019, at 14:33, Matthew Ryan wrote: >=20 > Hi Helmut, >=20 > The usual way to do this (for any language) is using ANSI escape = sequences. Code 8 sets the terminal to conceal characters and code 0 = resets the attributes, making them visible again. >=20 > For example, in a unix shell you can test this with echo and read: >=20 > echo -e '\x1b[8m'; read varname; echo -e '\x1b[0m' >=20 > To do the same from OCaml, you can output "\x1b[8m", read the = password, and then output "\x1b[0m" afterwards to switch printing back = on. >=20 > I believe that this will work on Windows 10, but earlier versions may = not have the necessary ANSI support. >=20 > Hope this helps, > Matthew >=20 > On Thu, 28 Mar 2019, 20:04 Helmut Brandl, > wrote: > Hello list, >=20 > Is there a portable way in ocaml to turn echoing off on standard input = from the terminal to read e.g. passwords? By portable I mean that it = works for Windows, Unix and Mac. >=20 > Thanks for any hint. >=20 > Regards > Helmut --Apple-Mail=_8DAA0056-F876-4EBE-9928-0F98CD1F9702 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii Thanks.

On Mar 28, 2019, at 14:33, = Matthew Ryan <matthew@o1labs.org> wrote:

Hi Helmut,

The usual = way to do this (for any language) is using ANSI escape sequences. Code 8 = sets the terminal to conceal characters and code 0 resets the = attributes, making them visible again.

For = example, in a unix shell you can test this with echo and read:

echo -e '\x1b[8m'; read varname; echo -e '\x1b[0m'

To do the same from OCaml, you can output "\x1b[8m", read the = password, and then output "\x1b[0m" afterwards to switch printing back = on.

I believe that this will work on Windows 10, but = earlier versions may not have the necessary ANSI support.

Hope this helps,
Matthew

On Thu, 28 Mar 2019, 20:04 Helmut = Brandl, <helmut.brandl@gmx.net> wrote:
Hello list,

Is there a portable way in ocaml to turn echoing off on standard input = from the terminal to read e.g. passwords? By portable I mean that it = works for Windows, Unix and Mac.

Thanks for any hint.

Regards
Helmut

= --Apple-Mail=_8DAA0056-F876-4EBE-9928-0F98CD1F9702--