Subscription
0
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning

You're reading fromPython for Secret Agents

Product type Book
Published in Aug 2014
Publisher
ISBN-13 9781783980420
Pages 216 pages
Edition 1st Edition
Languages
Concepts
Author (1):
Steven F. Lott

Table of Contents (12) Chapters Close

Python for Secret Agents
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Our Espionage Toolkit 2. Acquiring Intelligence Data 3. Encoding Secret Messages with Steganography 4. Drops, Hideouts, Meetups, and Lairs 5. A Spymaster's More Sensitive Analyses Index

Decoding a GeoRef code

When we decode a GeoRef code, we have to separate the two parts: the four characters at the beginning and the numeric details at the end. Once we've split off the first four characters, we can divide the number of remaining characters in half. One half of the digits will be longitude and the rest will be latitude.

The first four characters must be looked up in our special GeoRef alphabet. We'll find each character's position in the `ABCDEFGHJKLMNPQRSTUVWXYZ` string to get a numeric value. An expression such as `georef_uppercase.find('Q')` gives us 14: the position of Q in that alphabet. We can then multiply one position by 15° and add the other position number to translate two characters to the degrees portion of GeoRef.

The remaining digits are simply minutes, which are 1/60 of a degree. During conversion there is a matter of creating a number and possibly dividing it by 10 or 100. The final step is to take out the offsets that were used to avoid signed arithmetic.

The whole...

The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime