Feature #28095

Add hashing algorithms to stdWrap

Added by Fabrizio Branca almost 9 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
Should have
Category:
TypoScript
Target version:
-
Start date:
2011-07-11
Due date:
% Done:

100%

PHP Version:
5.3
Tags:
Complexity:
Sprint Focus:

Description

Currently it is not possible to get an md5 hash for a value in stdWrap. By adding some lines we could have md5 generation e.g. enabling you to get a gravatar image without using a userfunc:

page.10 = TEXT
page.10 {
value =
md5 = 1
wrap = <img src="http://www.gravatar.com/avatar/|" />
}


Related issues

Related to TYPO3 Core - Feature #28230: Add support for PBKDF2 to hashing Closed 2011-07-15
Precedes TYPO3 Core - Bug #28120: stdWrap.hash: Return nothing for non-existing algorithm Closed 2011-07-12

Associated revisions

Revision d2e68695 (diff)
Added by Fabrizio Branca almost 9 years ago

[FEATURE] Add hashing algorithms to stdWrap

Enable hashing the content through stdWrap using different hashing algorithms

Change-Id: I0673f33a1ca7bcb5784e5ab9f0def8db5ff7ea4b
Resolves: #28095
Releases: 4.6
Reviewed-on: http://review.typo3.org/3257
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers

History

#1 Updated by Xavier Perseguers almost 9 years ago

I don't like the idea of adding md5 alone. Better would be to support sha1 too and possibly lots of other hashing algorithms.

Have a look at http://ch.php.net/manual/en/function.hash-algos.php, PHP 5.3 has a lot of supported hashing algorithms. For me supporting md5, sha1, sha256 seems a must have if we implement this feature.

What about:

page.10 = TEXT
page.10 {
    value = mail@domain.com
    hash = md5
    wrap = <img src="http://www.gravatar.com/avatar/|" />
}

Just add stdWrap on hash (to let us do whatever we want) and then the implementation is basically this one:

if (function_exists('hash') && in_array($algo, hash_algos())) {
    $hash = hash($algo, $plain);
// elseif parts even optional I guess
} elseif ($algo === 'md5') {
    $hash = md5($plain);
} elseif ($algo === 'sha1') {
    $hash = sha1($plain)
} else {
    $hash = $plain;
}
return $hash;

#2 Updated by Fabrizio Branca almost 9 years ago

That looks good. I'm still struggling with setting up git/gerrit to push this patch. I'll create an updated patch for that and push that to Gerrit, if you don't mind...

#3 Updated by Mr. Hudson almost 9 years ago

Patch set 1 of change I0673f33a1ca7bcb5784e5ab9f0def8db5ff7ea4b has been pushed to the review server.
It is available at http://review.typo3.org/3257

#4 Updated by Mr. Hudson almost 9 years ago

Patch set 1 of change I3967541526149d1b40b2a676307a60a39670405a has been pushed to the review server.
It is available at http://review.typo3.org/3258

#5 Updated by Fabrizio Branca almost 9 years ago

I tried to update my first path for a whitespace fix, but it seems that I did not create a new patchset but a complete new patch by removing the Change-Id line. Sorry for that...

#6 Updated by Xavier Perseguers almost 9 years ago

Just abandone one of them, possibly the one without my review...

and possibly update commit message to describe what it does without saying that it was not possible before...

#7 Updated by Xavier Perseguers almost 9 years ago

Do not forget either the pending documentation in wiki for stdWrap once it is merged

#8 Updated by Mr. Hudson almost 9 years ago

Patch set 2 of change I0673f33a1ca7bcb5784e5ab9f0def8db5ff7ea4b has been pushed to the review server.
It is available at http://review.typo3.org/3257

#9 Updated by Mr. Hudson almost 9 years ago

Patch set 3 of change I0673f33a1ca7bcb5784e5ab9f0def8db5ff7ea4b has been pushed to the review server.
It is available at http://review.typo3.org/3257

#10 Updated by Mr. Hudson almost 9 years ago

Patch set 4 of change I0673f33a1ca7bcb5784e5ab9f0def8db5ff7ea4b has been pushed to the review server.
It is available at http://review.typo3.org/3257

#11 Updated by Xavier Perseguers almost 9 years ago

  • Subject changed from Add md5 to stdWrap to Add hashing algorithms to stdWrap
  • PHP Version set to 5.3

#12 Updated by Xavier Perseguers almost 9 years ago

  • Category changed from Content Rendering to TypoScript

#13 Updated by Xavier Perseguers almost 9 years ago

  • Status changed from New to Under Review

#14 Updated by Mr. Hudson almost 9 years ago

Patch set 5 of change I0673f33a1ca7bcb5784e5ab9f0def8db5ff7ea4b has been pushed to the review server.
It is available at http://review.typo3.org/3257

#15 Updated by Xavier Perseguers almost 9 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

Change has been successfully cherry-picked as d2e68695fd4e55d888544d7b7b8b699544ab16ed.

#16 Updated by Xavier Perseguers about 8 years ago

  • Status changed from Resolved to Closed

#17 Updated by Ernesto Baschny about 7 years ago

  • Target version deleted (1281)

Also available in: Atom PDF