Introduction| Download| Documentation| Development| Packages| References| Bibliographies



LibTMCG is a C++ library for creating secure and fair online card games. The library provides a sort of useful classes, algorithms, and high-level protocols to support an application programmer in writing such software. The most remarkable feature is the absence of a trusted third party (TTP), i.e. neither a central game server nor trusted hardware components are necessary. Thus, with the present library there is no need for an independent referee, because the applied protocols provide a basic level of confidentiality and fairness by itself. Consequently, the library is well-suited for peer-to-peer (P2P) environments where no TTP is available. Of course, we cannot avoid that malicious players share information about their private cards, but the protocols ensure that the shuffle of the deck is performed randomly (presumed that at least one player is honest) and thus the cards will be distributed uniformly among the players. Further, no coalition can learn the private cards of a player against his will (except for trivial conclusions). The corresponding cryptographic problem, actually called Mental Poker, has been studied since 1979 (Shamir, Rivest, and Adleman) by many authors (see the first section of [St05] for a short survey). LibTMCG provides the first practical implementation of such protocols.

The implementation relies on advanced cryptographic techniques---the so-called zero-knowledge proofs. Using these building blocks the high-level protocols minimize the effect of coalitions and preserve the confidentiality of the players' strategy, i.e. the players are not required to reveal their cards at the end of the game to show that they did not cheat. For many operations of Schindelhauer's toolbox the library provides optimized protocols based on standard cryptographic assumptions like Decisional Diffie Hellman (DDH). Therefore a reasonable level of performance is obtained. Moreover, for some of these protocols the included non-interactive zero-knowledge proofs (NIZK) reduce workload and communication complexity further.

LibTMCG is Free Software according to the definition of the Free Software Foundation. The source code is released under the GNU General Public License Version 2, or (at your option) any later version published by the Free Software Foundation.


The most recent version of LibTMCG is libTMCG-1.3.18.tar.gz. Older versions of LibTMCG are available on the download page.

Please verify the signature with a trusted version of the GNU Privacy Guard before you unzip the above file. The corresponding public key (will be revoked soon) can be found here. Additionally, you should verify the signature of my distributed signing key. The corresponding public key can be found on several key servers.


The LibTMCG Reference Manual (PDF) describes the application programming interface of LibTMCG. All relevant data types, public classes and security parameters are explained. The reader should have an advanced knowledge in applied cryptography and C++ programming. Reference is made at this point to the famous Handbook of Applied Cryptography for a brief introduction. For the underlying communication model and some broadcast primitives the outstanding textbook Introduction to Reliable and Secure Distributed Programming and the corresponding exercises are recommended.


LibTMCG is developed and maintained by Heiko Stamer. The development page (including the bug tracker, mailing lists, and GIT repository) is provided by nonGNU/Savannah. An API/ABI tracker for LibTMCG is kindly provided by the ABI Laboratory.


Packaging status


The cryptographic background and a detailed discussion of the implementation issues are beyond the scope of this web page. The interested reader is referred to the following papers:
Christian Schindelhauer. Toolbox for Mental Card Games. Technical Report A-98-14, University of Lübeck, 1998. ResearchGate
Adam Barnett and Nigel P. Smart. Mental Poker Revisited. In K.G. Paterson (Ed.): Cryptography and Coding 2003, Lecture Notes in Computer Science 2898, pp. 370--383, 2003.
Jens Groth. A Verifiable Secret Shuffle of Homomorphic Encryptions. Cryptology ePrint Archive, Report 2005/246, 2005.
Jens Groth. A Verifiable Secret Shuffle of Homomorphic Encryptions. Journal of Cryptology, Volume 23 Issue 4, pp. 546--579, 2010.
Sebastiaan de Hoogh, Berry Schoenmakers, Boris Skoric, and Jose Villegas. Verifiable Rotation of Homomorphic Encryptions. Public Key Cryptography 2009, Lecture Notes in Computer Science 5443, pp. 393--410, 2009.
Heiko Stamer. Kryptographische Skatrunde. (in German) Offene Systeme (ISSN 1619-0114), 4:10--30, 2004. PDF
Heiko Stamer. Efficient Electronic Gambling: An Extended Implementation of the Toolbox for Mental Card Games. Proceedings of the Western European Workshop on Research in Cryptology (WEWoRC 2005), Lecture Notes in Informatics P-74, pp. 1--12, 2005. PDF


We also maintain some comprehensive BibTeX bibliographies on and related topics. If you have any suggestions for entries, please contact me.

Copyright © 2005--2019 Heiko Stamer

This page is licensed under a Creative Commons Attribution-NoDerivatives 4.0 International License.