Tag: programming

  • Custom Polyglot Notebook Kernel

    Polyglot Notebooks are a great Visual Studio Code extension that allows you to create interactive Notebooks using multiple languages.

    Additional language support, extra commands, formatters, etc. can be added using Dotnet Nuget packages.

    For this article, we will be creating a custom kernel that will execute basic calculator commands with variable support.

    [Read More]
  • OpenID Connect - Dotnet Desktop Application

    Recently, I’ve been deep diving into JSON Web Tokens (JWT) and the OpenID Connect protocols. My end goal was to be able to use the OpenID Connect Authorization Flow to add authentication and authorization to a native desktop application using Dotnet.

    The basic authentication workflow for a native/desktop/console/ application is as follows (RFC 8252 Section 4.1):

    1. Application retrieves the following from the Authorization Server’s OpenID Connection Configuration Endpoint:
      • Signing Keys
      • Authorization Endpoint
      • Token Endpoint
    2. Application opens the system default browser to the Authorization Endpoint URI including the following details as query string parameters:
      • Response Type = “code”
      • Client ID
      • Redirect URI
      • Scope (Must include at least openid)
      • State (Secure random value)
      • Code Challenge
      • Code Challenge Method
    3. Authorization Server’s Authorization Endpoint receives the authorization request and then authenticates and authorizes the user.
    4. Authorization server issues an authorization code and redirects the browser to the specified Redirect URI with the response appended to it as query string parameters.
    5. Application receives the Redirect URI and retrieves the authentication code and validates the state from the response.
    6. Application sends the authentication code to the Token Endpoint including the following details:
      • Grant Type = “authorization_code”
      • Client ID
      • Authentication Code
      • Redirect URI
      • Code Verifier
    7. Authorization server validates the authorization code and issues the ID and Access Tokens.
    8. Application validates the ID Token using the Signing Keys obtained previously.

    There is a lot to unpack in each of these steps but we will cover everything as we implement them.

    [Read More]
  • ShortDash: Cross-platform Shortcut Dashboard

    A few months ago, I was sitting in a video conference and noticed that the room was getting hot. I have a fan but it was just out of reach and it would have been rude to walk out of the frame in the middle of the meeting. At that point I wished I had one of those digital power plugs that you can control from your phone. I did eventually get one of those plugs but you had to use their dedicated app to control it. I thought it would be much more convenient to have a central dashboard where I could control it. And then it would be nice to be able to execute other things. This led to some tinkering with https://ifttt.com/ and its web request functionality. Soon after, the idea of ShortDash began to form.

    ShortDash Dashboard

    ShortDash is a cross-platform shortcut dashboard for your local network. It allows you to create customizable dashboards of shortcuts and actions. You can even turn an old tablet or cell phone into your own personal shortcut dashboard.

    [Read More]
  • Outwitters Sports Network

    It has been a while since I posted here so I wanted to give some details to what I’ve been working on over the last year. About a year and a half ago I discovered an iOS turn-based strategy game called Outwitters. I was immediately hooked. It had enough variation and strategy to keep my interest. I was playing it all the time and recommending it to everyone who would listen.

    After you finish a game you have the ability to re-watch the replays and share them with others. This allowed you to learn new strategies or show off a triumphant victory. Unfortunately, you could only share the replays with someone who had an iOS device and had the Outwitters app installed. I wanted to watch the replays on my desktop so that I could easily compare and contrast different strategies against each other and improve my game.

    Outwitters Replay Viewer

    I began the process of reverse-engineering the replay protocol (with permission from the original developers) and creating the Outwitters Replay Viewer. I didn’t have any help from the original developers about protocols, file formats, or anything like that so I had to figure that all out on my own based on the data I could extract from the game. It took a bit of time to get everything squared away but in the end it worked out great.

    [Read More]
  • WebSolver: An Interactive Cryptogram Solver for the Web!

    A great carpenter does not need to know how to make a hammer or saw in order to create a masterpiece.

    Web Solver: Start
    A while back I wrote a bunch of articles describing how to create your own interactive cryptogram solver using python. I’ve used it a lot in my own personal solving and have had a few friends use it too but it definitely is not a tool for everyone. There are a lot of great tools out there for solving ciphers but many of them are very technical, require a special environment to run, or require programming knowledge and experience. Now, I don’t want to down play the usefulness of these great tools or tell anyone that they shouldn’t learn computer programming (Note: I think all computer users should know the very basics of programming logic as it is so useful for many things). That being said, there are many people out there who love a good challenge but either don’t have the desire or the time to learn to program. Sometimes the greater skill is knowing how to use the tools properly and efficiently. A great carpenter does not need to know how to make a hammer or saw in order to create a masterpiece.

    So for all you great carpenters (solvers) out there, I have ported my interactive cryptogram solver to the web! No downloads, no special environments (other than a modern web browser), and no programming skills needed. Just a clean area where you can do what you do best: solving.

    [Read More]
  • Creating an interactive cryptogram solver (Part IV)

    Execute Interactive Solver

    I’ve been working hard on this part of the series because I really wanted the interactive cryptogram solver to make it quick and painless to jump right into solving and still give you plenty of room to expand the functionality and reflect your own style of solving. In this part of the series, we will create solver.py which will become our gateway to solving. It will allow us to quickly select a cipher class that we want to work with. We will also add a self documenting system that will allow us to use the solver without memorizing all the commands or shortcuts that each solver class may use. So, lets just jump right back into the code!

    [Read More]
  • Creating an interactive cryptogram solver (Part III)

    Execute Interactive Solver

    In Part I and Part II of this series we created the framework for our interactive solver and finally had a working AristocratSolver class. In this part, we will enhance our existing framework by adding some commonly used functions, add frequency counting of characters and character sequences to the AristocratSolver class, add the ability to display the current plaintext and ciphertext keys to the AristocratSolver class and then finally create a PatristocratSolver class that reuses all our work in the AristocratSolver class.

    [Read More]
  • Creating an interactive cryptogram solver (Part II)

    Execute Interactive Solver

    In Part I of this series we started creating the framework for our solver by creating the Cipher and Aristocrat classes. You are probably thinking “This is a series about interactive solvers but this is all code!” Well, the classes inheriting from Cipher will be the ones doing all the work in our solver. In this part of the series we will finally create the CipherSolver class that will work with the Cipher classes to interactively get the work done. So lets just jump right into the code so we can finally get to our first working solver, the AristocratSolver class!

    [Read More]
  • Creating an interactive cryptogram solver (Part I)

    Execute Interactive Solver

    In this post we’ll first analyze what we are trying to accomplish and then begin to create an extensible framework that will allow us to adapt our solver to many different kinds of ciphers.

    Building the framework

    Our main goal is to create an extensible interactive solver, so lets break down the similarities that all ciphers have.  You’ve got to think really generic here. All ciphers have the following similarities:

    1. They manipulate some kind of text.
    2. They have an encryption algorithm.
    3. They have a decryption algorithm.

    With these three building blocks we can start creating our base framework.  Lets create a brand new folder that will contain all our source code and files that we will use.  I’m going name my folder “CryptogramSolver”.  Whenever we create new files or want to execute anything, it will be done from this location.

    [Read More]
  • Creating an interactive cryptogram solver (Introduction)

    Execute Interactive Solver

    I’ve been a member of the ACA (American Cryptogram Association) for about a year now.  I started out solving Aristocrats and Patristocrats with pen and paper.  It was definitely a slow start as trial and error created a lot of eraser dust on my desk.  Being a programmer by trade, my brain instantly sees how I could speed up the process using computers and programming.  Now, I didn’t want to ruin the sense of accomplishment that I got when I solved my first Aristocrat by hand by making the computer just do all the work for me.  It has taken much constraint for me not to write an automatic solver.  The happy medium I found was with computer assisted solving.  Let the computer do all the tedious manual labor and let my mind work on the actual solving process and techniques.

    I started writing my own interactive solver about a month after I joined the ACA and I wanted to share my experience with others.  Hopefully, someone will find this information useful or it might inspire them to delve into cryptography or programming.

    My prerequisites for an interactive solver are as follows:

    1. Has to be easily modified as needed when inspiration strikes.
    2. Has to be extendable so that it can be utilized for any kind of cipher.
    3. The programming language used has to be freely available and easy to install on most major operating systems.
    4. The programming language used has to be relatively easy to understand for new users.

    Out of all of the languages that I have used over the years, Python scored really high with the above prerequisites.  Python comes pre-installed on most major operating systems (except windows) or is very easy to obtain and install.  Now this doesn’t mean that you can’t use a different programming language to create an interactive solver.  Any programming language will work just fine.  Whatever you are comfortable with is the best choice for you.

    There are many resources for learning python so I won’t be going into great detail over all the language features or syntax nor will this be a beginner’s tutorial for python.  If you are in need of python learning materials check out the following:

    This is only the introduction but we’ll jump right into the programming in Part I.  Each Part will extend our solver with more functionality and hopefully we’ll end up with a easy to use interactive solver!

    Note: For now all the code will be for Python 2.6.  Most operating systems are still bundling this version so it is the most accessible for now.

    Creating an interactive cryptogram solver (Part I)