Diana Cryptosystem

Programming Praxis

[ Today’s exercise comes from the blog of long-time reader Ben Simon, after he declined my offer to guest-author the exercise and told me to steal it. The code and most of the text is his, so he gets the credit, not me. ]

It’s been a while since we had an exercise from our cryptography topic. Today’s exercise is the Diana Cryptosystem, also known as the trigraph cipher, which was used militarily by US forces during the Vietnam War and is theoretically unbreakable when used properly.

There are two pieces to the system: the trigraph itself, which is pictured at right, and a one-time pad, like this:

WHTVI AUCFU RETFK OMSAL
MYMNE ZIEGP UKVTF WZHOK
GORWY WETFR COYET OOWHY
ZPDDA CMMXT VYTJI RRQGU

To use the cipher, a section of the one-time pad is chosen and the two five-character groups that begin the section are transmitted unchanged. Thereafter, the…

Ver la entrada original 829 palabras más

Anuncios

Recursion versus iteration

A Programmers Place

The first programming language to allow functions to be recursively defined was McCarthy’s LISP in 1959. Its introduction was not controversial: nobody but John McCarthy had any say in what the language was going to be. In addition to his work on LISP, McCarthy was on the committee finalizing the Algol language in 1959 and 1960. In spite of the fact that a majority was opposed to it, the definition of Algol 60 ended up allowing recursively defined procedures. In [1] I gave an acount of how this happened.

Why was recursion such a big deal? For us this is hard to understand: for decades the programming language C, not exactly a paradigm of avant-garde, has allowed recursion. Still, remnants of unease remain. Still, in some introductory courses, recursion plays the role of a pons asinorum. Have instructors been traumatized by a sarcastic teacher finding, oh horrors…

Ver la entrada original 2.420 palabras más

Instalando PostgreSQL en openSuse

Primero:

$sudo zypper install postgresql postgresql-server pgadmin3

Iniciamos el servidor de postgreSQL:

$sudo /etc/init.d/postgresql start

Nos logueamos como el usuario postgres haciendo lo siguiente:

$sudo su postgres

$psql

Una ves adentro del shell de postgres tecleamos lo siguiente:

postgres=# alter user postgres with password 'postgres';

Si todo salió bien, entonces, el shell debe de mostrar un mensaje como el que sigue: ALTER ROLE

Y con eso se ha instalado postgreSQL en openSuse, ahora sólo les toca jugar con el!

Publicando artículos desde emacs



Para publicar un artículo desde emacs hay que instalar los siguientes paquetes:

  • xml-rpc
  • metaweblog
  • org2blog
  • htmlize

Una vez instalados hay que añadir lo siguiente en init.el (o un archivo propio de configuración de emacs):

;; Establece el directorio por default para escribir las notas
(setq org-directory "~/Documentos/Documentacion/Wordpress/notes")
;; Evita simbolos vacíos
(setq org-list-allow-alphabetical t)
(require 'org2blog-autoloads)
(require 'netrc)
;; En mi ~/.netrc/ tengo:
;; machine wp-wordpress login my_username password my_password
(setq wp-wordpress (netrc-machine (netrc-parse "~/.netrc") "wp-wordpress" t))
;; Configuración para publicar en wordpress
(setq org2blog/wp-blog-alist
      '(("wordpress"
         :url "https://miguelpinia.wordpress.com/xmlrpc.php"
         :username (netrc-get wp-cpbotha "login")
         :password (netrc-get wp-cpbotha "password")
         :default-title "Hello World"
         :default-categories ("org2blog" "emacs")
         :tags-as-categories nil)))
;; Títulos
(setq org2blog/wp-buffer-template
"-----------------------
#+TITLE: %s
-----------------------\n")
(defun my-format-function (format-string)
  (format format-string
          org2blog/wp-default-title
          (format-time-string "%d-%m-%Y" (current-time))))
(setq org2blog/wp-buffer-format-function 'my-format-function)
(setq org2blog/wp-use-sourcecode-shortcode 't)
(setq org2blog/wp-sourcecode-default-params nil)
;; Lenguajes soportados
(setq org2blog/wp-sourcecode-langs
      '("actionscript3" "bash" "coldfusion" "cpp" "csharp" "css" "delphi"
        "erlang" "fsharp" "diff" "groovy" "javascript" "java" "javafx" "matlab"
        "objc" "perl" "php" "text" "powershell" "python" "ruby" "scala" "sql"
        "vb" "xml"
        "sh" "emacs-lisp" "lisp" "lua"))
;; Con esto emacs va a realizar realzado de código en
;; #+BEGIN_SRC 
;;
;; 
;;
;; #+END_SRC
(setq org-src-fontify-natively t)

Y una vez que tienen su emacs configurado, hay que probar que todo funciona de la siguiente manera:

  • Crear un archivo con terminación .org en la carpeta que definieron.
  • Escribir en el.
  • M-x org2blog/wp-login
  • M-x org2blog/wp-post-buffer

Y eso sería todo.

Más información en: Manual de orgmode

Saludos