Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inquiry - Mask Number permanence #8

Closed
sg-modlab opened this issue Apr 10, 2023 · 4 comments
Closed

Inquiry - Mask Number permanence #8

sg-modlab opened this issue Apr 10, 2023 · 4 comments

Comments

@sg-modlab
Copy link

Exploring this plugin for a project and have a question. Reviewed the documentation and it seems that the maskNumbers filter will result in a string that is permanent. That over time if applied to the same number, you'd always get the same string when filter is applied. Is this accurate?

Over time is there anything you could envision that might result in the string the filter produces changing?

@rungta
Copy link
Member

rungta commented Apr 10, 2023

That is correct @sg-modlab. Given the same input, maskNumbers should always return the same output. However, if you want to dig deeper into this (and verify this contract), you should really check out the underlying Hashids library that maskNumbers is simply a wrapper for.

@rungta
Copy link
Member

rungta commented Apr 10, 2023

Just FYI, there are three parameters passed on to the Hashids constructor:

public function getHashIds()
{
if ($this->_hashIds === null) {
$hashidsAlphabet = Plugin::getInstance()->settings->hashidsAlphabet;
$hashidsMinLength = Plugin::getInstance()->settings->hashidsMinLength;
$this->_hashIds = $hashidsAlphabet === null
? new Hashids($this->secret, $hashidsMinLength)
: new Hashids($this->secret, $hashidsMinLength, $hashidsAlphabet);
}
return $this->_hashIds;
}

  1. Your security key, used as the salt
  2. Minimum length, or padding
  3. The alphabet

As long as all three of them remain the same, the output should be permanent.

@sg-modlab
Copy link
Author

And it is my understanding the plugin uses Craft's security key, correct. Only should add one to the config if this was used previously on a Craft 2 site.

@rungta
Copy link
Member

rungta commented Apr 10, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants