FANDOM

Welcome

Hi Puxlit, welcome to Fandom Developers Wiki! Thanks for your edit to the MediaWiki:Custom-EditConflictAlert/i18n.json page.

Please leave a message on my talk page if I can help with anything! Cqm (talk) 22:11, July 5, 2018 (UTC)

RE: AbuseLogRC

I've answered to you on the talk page. leviathan_89 @fandom 19:22, February 5, 2019 (UTC)

Module:Hash

Hello Puxlit. I am extremely new to Lua and have been working on a module of my own. For some odd reason, I decided to browse the current list of modules when yours caught my eye. Is there a way to use it from within a different module? If so, it would be perfect for what I am trying to do.
Andrewds1021 (talk) 03:56, February 12, 2020 (UTC)

Not easily at the moment, but I'm happy to export a few functions so that it can be more readily used in other libraries. What are you after? Do you just want to get a message's MD5 digest in hex form, or do you need access to the raw 128-bit hash value? Are your messages going to be short, or will they be large enough to warrant an init/update/finalize sort of interface? puxlit (talk) 05:36, February 12, 2020 (UTC)

I am not familiar with MD5 so I am not sure at what point I would need functions like init. All I know I need is the hex message digest; actually just the first two characters. The input would be a page name; more specifically, an image name. What I am trying to do with my module is provide a simpler interface for users to take advantage of Vignette via hotlinked images.
Some Background:
Long story short, we occassionally get users on Community Central asking if there is a way to crop/zoom images. Typically the easiest solution is to edit offline and upload a new version. However, in a few cases, it actually made more sense to use Vignette via hotlinked images. To simplify this process, I developed a template (prototype here, final version developed offline). To provide more general use, I decided to add the ability to get images from other wikis (ex. affiliate wiki modules) and the ability to have the image link somewhere. However, this turned out to require a lot of parser functions. In the past, other users I have interacted with like Fngplg have said that Lua can be a good alternative to parser functions. Thus I decided to try and make a Lua module for the task.
Andrewds1021 (talk) 20:44, February 12, 2020 (UTC)

I forgot to mention where MD5 comes in. The image URL includes the first two digits of the MD5 hash in it (according to KockaAdmiralac). Currently, both versions (parser functions and Lua) require the user to already know what this special "code" is. However, if I could use your module, I could remove this limitation for the Lua version.
Andrewds1021 (talk) 20:52, February 12, 2020 (UTC)

Thanks for your patience. It seems like Vignette shenanigans are quite a common use case; I've had reason to implement a similar template before (for cropping and to prevent Wikia from picking notice template images as the article's thumbnail).

I've updated the module to export something amenable to library consumption. Example usage follows.

-- Import
local hash = require('Dev:Hash')

-- Your implementation
local file_title = 'Izuku_Midoriya_school_profile.png'
local file_hash = hash.MD5(file_title).hexdigest()
local vignette_hash_path_components = string.format('/%s/%s', string.sub(file_hash, 0, 1), string.sub(file_hash, 0, 2))

I'll update the docs and test cases later. Please let me know if you have any additional questions. puxlit (talk) 11:07, February 17, 2020 (UTC); edited 11:40, February 17, 2020 (UTC)

No worries. Thanks for making the change. If I had known about your template, it might have saved me some time on mine. Oh well.
Andrewds1021 (talk) 20:04, February 19, 2020 (UTC)
Community content is available under CC-BY-SA unless otherwise noted.

Fandom may earn an affiliate commission on sales made from links on this page.

Stream the best stories.

Fandom may earn an affiliate commission on sales made from links on this page.

Get Disney+