Skip to content

Instantly share code, notes, and snippets.

@fabiomontefuscolo
Created September 25, 2014 20:59
Show Gist options
  • Save fabiomontefuscolo/44c55925cc39690cdb72 to your computer and use it in GitHub Desktop.
Save fabiomontefuscolo/44c55925cc39690cdb72 to your computer and use it in GitHub Desktop.
Sublime3 command that replace selected strings by their md5 hashes.
# -*- coding: utf-8 -*-
import hashlib
import sublime
import sublime_plugin
class Md5fyCommand(sublime_plugin.TextCommand):
def run(self, edit, *args):
for region in self.view.sel():
if not region.empty():
s = self.view.substr(region)
s = s.encode('utf-8')
s = hashlib.md5(s).hexdigest()
self.view.replace(edit, region, s)
@fabiomontefuscolo
Copy link
Author

Place this on ~/.config/sublime-text-3/Packages/User/md5fy.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment