How to use the iotedgedev.utility.Utility.get_sha256_hash function in iotedgedev

To help you get started, we’ve selected a few iotedgedev examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Azure / iotedgedev / tests / test_utility.py View on Github external
def test_get_sha256_hash():
    assert Utility.get_sha256_hash("foo") == "2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"
github Azure / iotedgedev / iotedgedev / connectionstring.py View on Github external
def __init__(self, hostname):
        self.name = hostname
        if self.name and "." in self.name:
            self.hub_name = self.name.split('.')[0]
            # get connection string hostname hash to count distint IoT Hub number
            self.name_hash = Utility.get_sha256_hash(self.name)
            # get hostname suffix (e.g., azure-devices.net) to distinguish national clouds
            self.name_suffix = self.name[self.name.index(".")+1:]
        else:
            self.hub_name = ""
            self.name_hash = ""
            self.name_suffix = ""
github Azure / iotedgedev / iotedgedev / decorators.py View on Github external
def _wrapped_func(*args, **kwargs):
        val = func(*args, **kwargs)
        if not val:
            raise ValueError('Return value is None')
        elif not isinstance(val, six.string_types):
            raise ValueError('Return value is not string')

        from .utility import Utility
        return Utility.get_sha256_hash(val)